[英]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.