1 回答

TA貢獻(xiàn)1790條經(jīng)驗(yàn) 獲得超9個(gè)贊
您僅將WebDriver實(shí)例聲明為:
public WebDriver driver;
您還需要對(duì)其進(jìn)行初始化,如下所示:
driver = new FirefoxDriver();
您的有效代碼塊的實(shí)例FirefoxOptions()將是:
System.setProperty("webdriver.firefox.driver","C:\\Users\\Nabila\\Downloads\\geckodriver-v0.26.0-win64\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--js-flags=--expose-gc");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
driver = new FirefoxDriver(options);
driver.navigate().to("http://www.demo.guru99.com/V4/");
driver.manage().timeouts().implicitlyWait(300, TimeUnit.SECONDS);
添加回答
舉報(bào)