【发布时间】:2019-11-14 22:56:10
【问题描述】:
自从我在我的测试中实现了无头配置后,我收到了这个问题:java.lang.NullPointerException
我尝试为 Gecko Headless 切换到其他类型的实现,但它们都不起作用
@BeforeTest
public static void OpenBrowser () {
System.setProperty("webdriver.gecko.driver","binaries/geckodriver");
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.addCommandLineOptions("-headless");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setBinary(firefoxBinary);
FirefoxDriver driver = new FirefoxDriver(firefoxOptions);
driver.get(...
}
执行测试后,我收到以下错误:java.lang.NullPointerException
【问题讨论】:
标签: java selenium-webdriver automation testng