use of org.openqa.selenium.firefox.FirefoxProfile in project charts by vaadin.
the class ChartsBrowserFactory method createFirefox.
private DesiredCapabilities createFirefox() {
DesiredCapabilities desiredCapabilities = create(Browser.FIREFOX, "45", Platform.WINDOWS);
desiredCapabilities.setCapability("marionette", "false");
// Configuring an empty Firefox profile fixes tests
// where a data point is clicked.
// - pointClick, select and unselect in ServerSideEvents tests
FirefoxProfile firefoxProfile = new FirefoxProfile();
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
return desiredCapabilities;
}
use of org.openqa.selenium.firefox.FirefoxProfile in project carina by qaprosoft.
the class DesktopCapabilitiesTest method getFirefoxCapabilityWithDefaultFirefoxProfileTest.
@Test(groups = { "DesktopCapabilitiesTestClass" })
public static void getFirefoxCapabilityWithDefaultFirefoxProfileTest() {
String testName = "firefox - getFirefoxDefaultCapabilityTest";
FirefoxCapabilities firefoxCapabilities = new FirefoxCapabilities();
DesiredCapabilities capabilities = firefoxCapabilities.getCapability(testName);
Assert.assertEquals(capabilities.getBrowserName(), BrowserType.FIREFOX, "Returned browser name is not valid!");
Assert.assertEquals(capabilities.getCapability("name"), testName, "Returned test name is not valid!");
Assert.assertFalse((Boolean) capabilities.getCapability(CapabilityType.TAKES_SCREENSHOT), "Returned capability value is not valid!");
boolean actualMediaEmeEnabled = ((FirefoxProfile) capabilities.getCapability("firefox_profile")).getBooleanPreference("media.eme.enabled", false);
Assert.assertEquals(actualMediaEmeEnabled, MEDIA_EME_ENABLED, "Returned firefox profile preference is not valid!");
boolean actualMediaGmpManagerUpdateEnabled = ((FirefoxProfile) capabilities.getCapability("firefox_profile")).getBooleanPreference("media.gmp-manager.updateEnabled", false);
Assert.assertEquals(actualMediaGmpManagerUpdateEnabled, MEDIA_GMP_MANAGER_UPDATE_ENABLED, "Returned firefox profile preference is not valid!");
}
use of org.openqa.selenium.firefox.FirefoxProfile in project Asqatasun by Asqatasun.
the class ProfileFactory method getProfile.
/**
*
* @return
* a set-up Firefox profile
*/
private FirefoxProfile getProfile(boolean loadImage) {
if (StringUtils.isNotBlank(pathToPreSetProfile)) {
File presetProfileDir = new File(pathToPreSetProfile);
if (presetProfileDir.exists() && presetProfileDir.canRead() && presetProfileDir.canExecute() && presetProfileDir.canWrite()) {
Logger.getLogger(this.getClass()).debug("Start firefox profile with path " + presetProfileDir.getAbsolutePath());
return new FirefoxProfile(presetProfileDir);
} else {
Logger.getLogger(this.getClass()).debug("The profile with path " + presetProfileDir.getAbsolutePath() + " doesn't exist or don't have permissions");
}
}
Logger.getLogger(this.getClass()).debug("Start firefox with fresh new profile");
FirefoxProfile firefoxProfile = new FirefoxProfile();
setUpPreferences(firefoxProfile, loadImage);
// setUpExtensions(firefoxProfile);
setUpProxy(firefoxProfile);
return firefoxProfile;
}
use of org.openqa.selenium.firefox.FirefoxProfile in project iTest by e-government-ua.
the class SetupAndTeardown method SetUp.
@BeforeMethod(alwaysRun = true)
public void SetUp() throws IOException {
// driver = new FirefoxDriver(profileFF);
if (null == driver) {
/**
* ******* Для локального тестирования установить switch ("chrome")
* для jenkins switch ("firefox") **********
*/
switch("firefox") {
case "firefox":
/**
* ******* Закоментить для для запуска на своем профиле и
* откоментить для запуска на дефолтном **********
*/
//Save the path of the XPI files as per your saved location
String cryptopluginPath = "src/test/resources/files/cryptoplugin_ext_id@privatbank.ua.xpi";
File cryptoplugin = new File(cryptopluginPath);
FirefoxProfile profile = new FirefoxProfile();
// profile.addExtension(cryptoplugin);
profile.setEnableNativeEvents(true);
profile.setAcceptUntrustedCertificates(true);
// profile.addExtension(cryptoplugin);
/**
* ******* Раскомментить для запуска на своем профиле и
* закоментить для дефолтного **********
*/
// ProfilesIni allProfiles = new ProfilesIni();
// FirefoxProfile profile = allProfiles.getProfile("default");
profile.setPreference("extensions.cryptoplugin_ext_id@privatbank.currentVersion", "9.9.9");
profile.setEnableNativeEvents(true);
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(true);
profile.setPreference("javascript.enabled", true);
profile.setPreference("geo.enabled", false);
profile.setPreference("extensions.cryptoplugin_ext_id@privatbank.ua.currentVersion", "999.999.999");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
capabilities.setCapability("unexpectedAlertBehaviour", "ignore");
System.out.println("Tests will be run (or rerun) in Firefox with custom profile...");
driver = WebDriverFactory.getDriver(capabilities);
/**
* ******* Для локального тестирования **********
*/
// case "chrome":
// System.setProperty("webdriver.chrome.driver", "src\\test\\resources\\files\\chromedriver.exe");
// capabilities = DesiredCapabilities.chrome();
// options = new ChromeOptions();
// System.out.println("Tests will be run (or rerun) in Chrome with custom profile...");
// break;
// default:
this.driver = new FirefoxDriver();
System.out.println("Tests will be run (or rerun) in Firefox...");
break;
}
driver = WebDriverFactory.getDriver(capabilities);
this.driver.manage().timeouts().implicitlyWait(CV.implicitTimeWait, TimeUnit.SECONDS);
this.driver.manage().window().maximize();
this.driver.manage().deleteAllCookies();
}
}
use of org.openqa.selenium.firefox.FirefoxProfile in project SneakerBot by Penor.
the class Adidas method splash.
@SuppressWarnings("deprecation")
public void splash() {
try {
WebDriverWait wait = new WebDriverWait(driver, 60L);
print("Loading webpage: " + url);
driver.get(url);
wait.until(new Function<WebDriver, Boolean>() {
public Boolean apply(WebDriver d) {
// + String.valueOf(((JavascriptExecutor) d).executeScript("return document.readyState")));
return String.valueOf(((JavascriptExecutor) d).executeScript("return document.readyState")).equals("complete");
}
});
// TODO: Get to splash page.
boolean displayed = wait.until(x -> x.findElement(By.className("sk-fading-circle"))).isDisplayed();
if (displayed) {
print(proxy != null ? ("[" + proxy.getPassword() + ":" + proxy.getPort() + "] -> ") : "" + "waiting at splash page!");
while (driver.findElements(By.className("g-recaptcha")).size() == 0) Thread.sleep(5000L);
print(proxy != null ? ("[" + proxy.getPassword() + ":" + proxy.getPort() + "] -> ") : "" + "passed splash page!");
driver.manage().getCookies().stream().forEach(c -> {
if (c.getValue().contains("hmac")) {
hmac = c.getValue();
hmacExpiration = c.getExpiry();
}
});
if (driver.findElements(By.className("g-recaptcha")).size() > 0)
siteKey = driver.findElement(By.className("g-recaptcha")).getAttribute("data-sitekey");
if (driver.findElements(By.id("flashproductform")).size() > 0)
clientId = driver.findElement(By.id("flashproductform")).getAttribute("action").split("clientId=")[1];
Date timeLeft = new Date(hmacExpiration.getTime() - System.currentTimeMillis());
print("[Success] -> SiteKey: " + siteKey + " Client ID: " + clientId + " HMAC: " + hmac + " Time Left: " + timeLeft.getMinutes() + "m" + timeLeft.getSeconds() + "s");
} else
print("Error, Element displayed: " + displayed);
if (manual) {
FirefoxProfile profile = new FirefoxProfile();
if (proxy != null) {
profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http", proxy.getAddress());
profile.setPreference("network.proxy.http_port", proxy.getPort());
profile.setPreference("network.proxy.ssl", proxy.getAddress());
profile.setPreference("network.proxy.ssl_port", proxy.getPort());
}
// profile.setPreference("general.useragent.override", driver.set);
WebDriver checkout = new FirefoxDriver(profile);
for (Cookie cookie : driver.manage().getCookies()) checkout.manage().addCookie(cookie);
checkout.get(driver.getCurrentUrl());
} else
while (!carted && hmacExpiration.getTime() > System.currentTimeMillis()) atc();
} catch (Exception e) {
String name = e.getClass().getName();
print("[Exception] -> " + name);
carted = true;
if (name.equals("org.openqa.selenium.TimeoutException"))
carted = false;
} finally {
print(carted ? "Closing driver, and ending" : "Failed, Retrying...");
if (carted) {
driver.quit();
Thread.currentThread().interrupt();
}
}
}
Aggregations