Я не могу установить профиль по умолчанию для Firefox в Selenium Webdriver 3, потому что такого конструктора нет в классе FirefoxDriver
.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.ProfilesIni;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class SeleniumStartTest {
@Test
public void seleniumFirefox() {
System.setProperty("webdriver.gecko.driver", "C:\\Users\\FirefoxDriver\\geckodriver.exe");
ProfilesIni profileIni = new ProfilesIni();
FirefoxProfile profile = profileIni.getProfile("default");
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://www.google.com");
}
}
Ошибка компиляции в коде Java: Код Java
pom.xml
зависимости Maven: Selenium 3.14.0
Версия Firefox: Firefox версии 62.0.2
FirefoxOptions fo = new FirefoxOptions(); fo.setProfile(profile); WebDriver driver = new FirefoxDriver(fo);
- person skandigraun   schedule 23.09.2018