Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@BorisOsipov
Created January 11, 2018 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BorisOsipov/c99fce80af7e5209b09f72450db96eb1 to your computer and use it in GitHub Desktop.
Save BorisOsipov/c99fce80af7e5209b09f72450db96eb1 to your computer and use it in GitHub Desktop.
Вот честно не найду сейчас. Но сделал следующие шаги
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