0
运行我想运行在无头模式的脚本为所有3个浏览器的Chrome,火狐& IE如何设置能力IE浏览器在无头模式
以下是Chrome的代码:
System.setProperty("webdriver.chrome.driver", "./drive/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("window-size=1400,600");
WebDriver driver = new ChromeDriver(options);
driver.get("http://www.google.com/");
注:它的做工精细
火狐:
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.addCommandLineOptions("--headless");
System.setProperty("webdriver.gecko.driver", "./drive/geckodriver.exe");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(firefoxBinary);
FirefoxDriver driver = new FirefoxDriver(firefoxOptions);
driver.get("http://www.google.com/");
注:它的做工精细
IE:
同样地,我想在IE的选项
执行