use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class ParallelTest method setUp.
@Parameters(value = { "browser", "version", "platform" })
@BeforeClass
public void setUp(String browser, String version, String platform) throws MalformedURLException, InterruptedException, WebDriverException {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("platform", platform);
capability.setCapability("browserName", browser);
capability.setCapability("browserVersion", version);
capability.setCapability("project", "P1");
capability.setCapability("build", "1.0");
driver = new RemoteWebDriver(new URL("http://" + USERNAME + ":" + ACCESS_KEY + "@hub.browserstack.com/wd/hub"), capability);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class AppTest method setup.
@BeforeClass
public static void setup() throws IOException {
// System.out.println(System.getProperty("user.dir"));
FirefoxProfile profile = new FirefoxProfile();
try {
profile.addExtension(new File(System.getProperty("user.dir") + "/src/main/resources/firefox"));
} catch (IOException e) {
e.printStackTrace();
}
// http://www.programcreek.com/java-api-examples/index.php?api=org.openqa.selenium.firefox.FirefoxProfile
// http://www.atetric.com/atetric/javadoc/org.seleniumhq.selenium/selenium-firefox-driver/2.43.1/src-html/org/openqa/selenium/firefox/FirefoxProfile.html
profile.setPreference("app.update.enabled", false);
// Setting preferences
// profile.setPreference("extensions.firebug.currentVersion", "2.0");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
capabilities.setPlatform(org.openqa.selenium.Platform.ANY);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
driver = new RemoteWebDriver(capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class SearchTest method setUp.
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities("firefox", "", Platform.ANY);
WebDriver seleniumDriver = new FirefoxDriver(capabilities);
// new ChromeDriver()
// ChromeDriverManager.getInstance().setup();
// java.lang.NoClassDefFoundError:
// org/openqa/selenium/remote/service/DriverService$Builder
steps = new WebDriverSteps(seleniumDriver);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class AngularAndWebDriverTest method setupBrowser.
@SuppressWarnings("deprecation")
private void setupBrowser(String browser) {
System.setProperty("webdriver.chrome.driver", (new File("c:/java/selenium/chromedriver.exe")).getAbsolutePath());
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions chromeOptions = new ChromeOptions();
Map<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("profile.default_content_settings.popups", 0);
String downloadFilepath = System.getProperty("user.dir") + System.getProperty("file.separator") + "target" + System.getProperty("file.separator");
chromePrefs.put("download.prompt_for_download", "false");
chromePrefs.put("download.directory_upgrade", "true");
chromePrefs.put("plugins.always_open_pdf_externally", "true");
chromePrefs.put("download.default_directory", downloadFilepath);
chromePrefs.put("enableNetwork", "true");
chromeOptions.setExperimentalOption("prefs", chromePrefs);
for (String optionAgrument : (new String[] { "--user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20120101 Firefox/33.0", "--allow-running-insecure-content", "--allow-insecure-localhost", "--enable-local-file-accesses", "--disable-notifications", "--disable-save-password-bubble", /* "start-maximized" , */
"--browser.download.folderList=2", "--disable-web-security", "--no-proxy-server", "--browser.helperApps.neverAsk.saveToDisk=image/jpg,text/csv,text/xml,application/xml,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/excel,application/pdf", String.format("--browser.download.dir=%s", downloadFilepath) /* "--user-data-dir=/path/to/your/custom/profile" , */
})) {
chromeOptions.addArguments(optionAgrument);
}
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
capabilities.setCapability(org.openqa.selenium.chrome.ChromeOptions.CAPABILITY, chromeOptions);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capabilities);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project selenium_java by sergueik.
the class TestWithData method beforeSuite.
@BeforeSuite
public void beforeSuite() {
System.setProperty("webdriver.chrome.driver", (new File("c:/java/selenium/chromedriver.exe")).getAbsolutePath());
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
Map<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("profile.default_content_settings.popups", 0);
String downloadFilepath = System.getProperty("user.dir") + System.getProperty("file.separator") + "target" + System.getProperty("file.separator");
chromePrefs.put("download.default_directory", downloadFilepath);
chromePrefs.put("enableNetwork", "true");
options.setExperimentalOption("prefs", chromePrefs);
options.addArguments("allow-running-insecure-content");
options.addArguments("allow-insecure-localhost");
options.addArguments("enable-local-file-accesses");
options.addArguments("disable-notifications");
// options.addArguments("start-maximized");
options.addArguments("browser.download.folderList=2");
options.addArguments("--browser.helperApps.neverAsk.saveToDisk=image/jpg,text/csv,text/xml,application/xml,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/excel,application/pdf");
options.addArguments("browser.download.dir=" + downloadFilepath);
// options.addArguments("user-data-dir=/path/to/your/custom/profile");
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capabilities);
actions = new Actions(driver);
driver.manage().timeouts().setScriptTimeout(scriptTimeout, TimeUnit.SECONDS);
wait = new WebDriverWait(driver, flexibleWait);
wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
screenshot = ((TakesScreenshot) driver);
js = ((JavascriptExecutor) driver);
mySheet = getSpreadSheet();
}
Aggregations