我正在尝试使用 Selenium 打开本地文件。使用下面的代码,Firefox 正在打开,但出现错误org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start..
File gecko = new File("resources/geckodriver64.exe");
System.setProperty("webdriver.gecko.driver", gecko.getAbsolutePath());
FirefoxOptions capabilities = new FirefoxOptions();
capabilities.setCapability("marionette", false);
WebDriver driver = new FirefoxDriver(capabilities);
driver.get("file:///C:/example/myfile.pdf");
有人能帮我吗 ?我在互联网上找不到任何东西。
相关分类