[英]How to disable Insecure Password Warning in Firefox using Selenium Webdriver with Java
[英]How to write commands into the Firefox console using Selenium WebDriver with Java?
我使用Selenium Webdriver打开Firefox控制台。
@Test
public void seleniumFirefoxConsole() {
System.setProperty("webdriver.gecko.driver", "C:\\Users\\FirefoxDriver\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.addArguments("-console");
WebDriver driver = new FirefoxDriver(options);
driver.get("http://www.google.com");
}
如何使用以下Java代码在此控制台中编写命令:
console.log("Hello, Firefox console from selenium");
使用JavascriptExecutor从硒运行javascript命令。 只需将以下几行添加到您的测试用例中:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("console.log('Hello, Firefox console from selenium');");
顺便说一句-您的用例是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.