Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove desired capabilities #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
firefox update as well
joshmgrant committed Jan 22, 2019
commit 17eb98072753541d47ee71577d4fef15d5f8e1f8
32 changes: 13 additions & 19 deletions java/testng/W3CFireFoxTest.java
Original file line number Diff line number Diff line change
@@ -33,13 +33,6 @@ public void setup(Method method) throws MalformedURLException {
String username = System.getenv("SAUCE_USERNAME");
String accessKey = System.getenv("SAUCE_ACCESS_KEY");
String methodName = method.getName();

/** FirefoxOptions allows us to set browser-specific behavior such as profile settings, headless capabilities, insecure tls certs,
and in this example--the W3C protocol
For more information see: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/firefox/FirefoxOptions.html */

FirefoxOptions foxOpts = new FirefoxOptions();
foxOpts.setCapability("w3c", true);

/** The MutableCapabilities class came into existence with Selenium 3.6.0 and acts as the parent class for
all browser implementations--including the FirefoxOptions class extension.
@@ -50,18 +43,19 @@ public void setup(Method method) throws MalformedURLException {
sauceOpts.setCapability("seleniumVersion", "3.141.59");
sauceOpts.setCapability("username", username);
sauceOpts.setCapability("accessKey", accessKey);
sauceOpts.setCapability("tags", "w3c-chrome-tests")

/** Below we see the use of our other capability objects, 'foxOpts' and 'sauceOpts',
defined in 'moz:firefoxOptions' and sauce:options respectively.
*/
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("moz:firefoxOptions", foxOpts);
caps.setCapability("sauce:options", sauceOpts);
caps.setCapability("browserName", "firefox");
caps.setCapability("browserVersion", "64.0");
caps.setCapability("platformName", "windows 10");

sauceOpts.setCapability("tags", "w3c-firefox-tests")

/** FirefoxOptions allows us to set browser-specific behavior such as profile settings, headless capabilities, insecure tls certs,
and in this example--the W3C protocol
For more information see: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/firefox/FirefoxOptions.html */

FirefoxOptions foxOpts = new FirefoxOptions();
options.setCapability("w3c", true);
options.setCapability("browserName", "firefox");
options.setCapability("browserVersion", "64.0");
options.setCapability("platformName", "windows 10");
option.setCapability("sauce:options", sauceOpts);

/** Finally, we pass our DesiredCapabilities object 'caps' as a parameter of our RemoteWebDriver instance */
String sauceUrl = "https://ondemand.saucelabs.com:443/wd/hub";
URL url = new URL(sauceUrl);