-
-
Save BorisOsipov/c99fce80af7e5209b09f72450db96eb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Вот честно не найду сейчас. Но сделал следующие шаги | |
1. Скачал Firefox Nightly | |
2. Прописал следующие ключи в about:config | |
marionette.defaultPrefs.enabled true | |
marionette.defaultPrefs.port 2828 | |
marionette.enabled true | |
3. Запустил Firefox с ключиком --marionette | |
4. запустил | |
``` geckodriver.exe --connect-existing --marionette-port 2828 ``` | |
5. Код | |
```import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
public class ProbaClass { | |
public static void main(String[] args) { | |
System.setProperty("webdriver.gecko.driver", "path\to\driver"); | |
System.setProperty("webdriver.firefox.useExisting", "true"); | |
System.setProperty("webdriver.gecko.driver.port", "4444"); | |
WebDriver firefoxDriver = null; | |
try { | |
firefoxDriver = new RemoteWebDriver(new URL("http://localhost:4444"), DesiredCapabilities.firefox()); | |
} catch (MalformedURLException e) { | |
e.printStackTrace(); | |
} | |
firefoxDriver.get("http://google.com.ua"); | |
try { | |
Thread.sleep(10000); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
firefoxDriver.quit(); | |
} | |
} | |
``` | |
(edited) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment