Coder Social home page Coder Social logo

joostvanwollingen / startusingseleniumwebdriver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eviltester/startusingseleniumwebdriver

0.0 1.0 0.0 35 KB

Source code to support the online course Start Using Selenium WebDriver with Java

Home Page: seleniumsimplified.com/get-started/

Java 100.00%

startusingseleniumwebdriver's Introduction

startUsingSeleniumWebDriver

Source code to support getting started using Selenium WebDriver with Java

The source code has only really been uploaded in case people encounter problems following the instructions or make a very simple mistake that they cannot figure out.

Please read the comments below, and the source code comments if you are having trouble starting work with Firefox.

Steps

If you are using Chrome and have added ChromeDriver to the path then use the command line:

mvn test -Dtest=MyFirstChromeTest

For Firefox see the notes below for the version of Selenium WebDriver you are using.

Do not run mvn test because some of the tests are WebDriver version dependant and at least one will fail.

Author: Alan Richardson

See related blog posts:

Notes for Selenium WebDriver Above 3.0.1

Versions of Selenium WebDriver 3.1.0 and above have removed the MarionetteDriver class, and FirefoxDriver should now be used for all versions of Firefox.

The MyFirstTestFF48 has been commented out in the code.

If you are using version 3.0.1 or below then you can uncomment out the main class code and the imports and you can use this test.

Notes for Selenium WebDriver 3.0.1

Running with Firefox

If you are using Firefox 45 Extended Release version (or Firefox < v48) then to run the test from the command line use:

mvn test -Dtest=MyFirstLegacyFFTest

If you are using Firefox 48+ and have added Marionette geckodriver.exe to the path then use the command line:

mvn test -Dtest=MyFirstTest

The following will also work with Firefox 48+, but will fail in a future version of WebDriver because the MarionetteDriver is deprecated.

mvn test -Dtest=MyFirstTestFF48

Running with Chrome

If you are using Chrome and have added ChromeDriver to the path then use the command line:

mvn test -Dtest=MyFirstChromeTest

Notes for Selenium WebDriver 2.53.1

Running with Firefox

If you are using Firefox 45 Extended Release version (or Firefox < v48) then to run the test from the command line use:

mvn test -Dtest=MyFirstTest

If you are using Firefox 48+ and have added Marionette geckodriver.exe to the path (renamed to wires.exe) then use the command line:

mvn test -Dtest=MyFirstTestFF48

Running with Chrome

If you are using Chrome and have added ChromeDriver to the path then use the command line:

mvn test -Dtest=MyFirstChromeTest

Update 19th October 2016

Updated the Notes to cover Firefox on WebDriver 2.53.1 and 3.0.1.

Update 4th October 2016

Update 30th September 2016

I have added a test for ChromeDriver into the code:

  • MyFirstChromeTest

This has comments explaining where to locate the chromedriver.exe or just add the folder with chromedriver.exe to the path.

Update 27th September 2016

I have added two tests into the code:

  • MyFirstTest
  • MyFirstTestFF48

MyFirstTest has all the comments explaining all the multiple uses of Firefox and defaults to using the FirefoxDriver - in selenium 2 this will only work with Firefox 47 or below. With Selenium 3 you could run this if Marionette driver is on the path.

MyFirstTestFF48 is a cut down test that uses the MarionetteDriver and assumes that wires.exe is on the path.

Update 7th July 2016

Firefox 47 was incompatible with Selenium 2.53.0 so we needed to use marionette driver.

Firefox 47.1 is compatible with Selenium 2.53.1 allowing us to use the FirefoxDriver again.

The blog post below describes how to use a local version of Selenium with maven if any incompatibility happens again and you need to move to a different version of WebDriver which is not on maven central.

Update 22nd June 2016

Added information about using portable firefox driver and more comments.

Update 25th April 2016

Firefox 46 changes the way that WebDriver has to interact with it. So the built in FirefoxDriver did not work. You need to install Firefox 45 from Firefox Extended Support Release to continue using FirefoxDriver.

If you want to use Firefox 46 and later then you may need to use the Marionette driver.

Follow the instructions on the Marionette page to download it. You do not need to add it to your path, you can control that through a system property - see the code in this project for more detail.

You can also use portable Firefox as described in this blog post

All of this is explained in the source code, or in the blog posts:

Pre April 2016 updates

The code has changed slightly because we now need to do a .close and a .quit to exit Firefox

And I've updated the version of WebDriver.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.