3 回答

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超9個(gè)贊
FirefoxDriver
geckodriver
geckodriver
wires
webdriver.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貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊
從 解壓檔案 為Marionette創(chuàng)建一個(gè)目錄(即, mkdir -p /opt/marionette
)將解壓縮的可執(zhí)行文件移動(dòng)到您創(chuàng)建的目錄中。 更新您的 $PATH
若要包含可執(zhí)行文件(同時(shí),請(qǐng)編輯 .bash_profile
如果你愿意的話) :邦邦:確保你 chmod +x /opt/marionette/wires-x.x.x
所以它是可執(zhí)行的 在啟動(dòng)過(guò)程中,請(qǐng)確保使用以下代碼(這是我在Mac上使用的代碼)
速記
Java片段
WebDriver browser = new MarionetteDriver();System.setProperty("webdriver.gecko.driver", "/opt/marionette/wires-0.7.1-OSX");
添加回答
舉報(bào)