God*_*her 6 c# automation keypress selenium-webdriver
我有一种情况,我必须按'ESC'键才能停止加载页面..
这肯定是必需的,否则页面将继续加载一分钟.
如何使用selenium webdriver按"Esc"键.这必须使用C#完成.
另外,请提及必须导入的类
您可以使用Actions类将密钥直接发送到浏览器.请参阅以下代码的最后两行:
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
IWebDriver driver = new FirefoxDriver(ffprofile);
driver.Navigate().GoToUrl("http://www.google.com");
driver.FindElement(By.Name("q")).SendKeys("Stack Overflow");
driver.FindElement(By.Name("q")).Submit();
Actions action = new Actions(driver);
action.SendKeys(OpenQA.Selenium.Keys.Escape);
Run Code Online (Sandbox Code Playgroud)
希望有所帮助.
| 归档时间: |
|
| 查看次数: |
16480 次 |
| 最近记录: |