3 回答
TA贡献1830条经验 获得超9个赞
FirefoxDrivergeckodriver
geckodriverwireswebdriver.gecko.driver
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");<dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>webdrivermanager</artifactId> <version>3.6.1</version></dependency>
WebDriverManager.firefoxdriver().setup();
public class FirefoxTest {
protected WebDriver driver;
@BeforeClass
public static void setupClass() {
WebDriverManager.firefoxdriver().setup();
}
@Before
public void setupTest() {
driver = new FirefoxDriver();
}
@After
public void teardown() {
if (driver != null) {
driver.quit();
}
}
@Test
public void test() {
// Your test code here
}}更新
FirefoxDriver
TA贡献1836条经验 获得超3个赞
从 解压档案 为Marionette创建一个目录(即, mkdir -p /opt/marionette)将解压缩的可执行文件移动到您创建的目录中。 更新您的 $PATH若要包含可执行文件(同时,请编辑 .bash_profile如果你愿意的话) :邦邦:确保你 chmod +x /opt/marionette/wires-x.x.x所以它是可执行的 在启动过程中,请确保使用以下代码(这是我在Mac上使用的代码)
速记
Java片段
WebDriver browser = new MarionetteDriver();System.setProperty("webdriver.gecko.driver", "/opt/marionette/wires-0.7.1-OSX");添加回答
举报
