DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Upgrading to Selenium 3 With My First Selenium Project

Alan Richardson provides a thorough walkthrough on how you can upgrade to the newest version of Selenium, along with a video.

Alan Richardson user avatar by
Alan Richardson
·
Oct. 17, 16 · Tutorial
Like (6)
Save
Tweet
Share
4.05K Views

Join the DZone community and get the full member experience.

Join For Free

Selenium 3 is out and you can read the big announcement here. It's available to start using now.

I’ll be checking my course against Selenium 3 later, but for the moment, here are the steps that you need to take to upgrade.

Upgrading to Selenium 3.0

Using startUsingSeleniumWebDriver as an example.

Change the pom.xml. 

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>

This becomes:

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.0</version>
        </dependency>

Ta-da!

Not Quite Ta-Da

For Marionette, we need to update to the most recent version, which can be found here. Note: Version 11.0.1 was used at the time of writing.

With Selenium 3, MarionetteDriver is deprecated. My test MyFirstTestFF48 uses MarionetteDriver. I can see that MarionetteDriver is deprecated, but it still works, provided that I have Marionette Geckodriver setup correctly.

It works if I install v 11.0.1 of Marionette Driver and have it named as geckodriver.exe on the path. However, I should migrate away from using MarionetteDriver in my code because it is deprecated.

Back to FirefoxDriver

FirefoxDriver now defaults to use the Marionette driver. So I can use Marionette by running my FirefoxDriver test, which uses Selenium 3, by default. Now:

  • FirefoxDriver now uses Marionette.
  • I no longer have to rename geckodriver.exe to wires.exe. 
  • I now use geckodriver.exe. 

If you want to switch between 2.53.1 and 3.0.0, then I’d add the Marionette driver folder to the path and:

  • Have Version 0.9.0 named as wires.exe. 
  • Have Version 11.0.1 named as geckodriver.exe. 

My Firefox test, mvn test -Dtest=MyFirstTest, works if I install Version 11.0.1 of Marionette Driver and have it named as geckodriver.exe on the path and I use FirefoxDriver to instantiate the driver.

Firefox Marionette Summary:

To use Marionette geckodriver.exe for Firefox with Selenium 3:

  • Install the latest version of geckodriver.exe here.
  • Add geckodriver.exe to the path.
  • Use FirefoxDriver in your code.

Legacy Firefox?

What if you want to use the built-in FirefoxDriver, i.e., for Firefox Extended Support Release or portable Firefox? Well, you still can! You just have to:

  • Set the Firefox driver capability “Marionette” to false.
  • Set the firefox_binary capability to the path of your Legacy Firefox.

For example:

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", false);
capabilities.setCapability("firefox_binary",
       new File(System.getProperty("user.dir"),
       "/tools/FirefoxPortable/FirefoxPortable.exe").
              getAbsolutePath());
WebDriver driver = new FirefoxDriver(capabilities);

Work to Do

I have some work to do to update the startUsingSeleniumWebDriver and check my course tests against Selenium 3. If I have to update, anything I’ll blog about it.

Summary

  • Update pom.xml to use <version>3.0.0</version>.
  • Download the latest version ofgeckodriver.exe.
  • Add geckodriver.exe to the path.
  • Use FirefoxDriver in your code.
  • Set the "Marionette" capability to false if you want to use legacy FirefoxDriver.

Driver (software) Testing Moment Release (agency) IT Blog Download

Published at DZone with permission of Alan Richardson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Quest for REST
  • How To Validate Three Common Document Types in Python
  • Cloud-Based Transportation Management System
  • Beginners’ Guide to Run a Linux Server Securely

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: