GithubHelp home page GithubHelp logo

albinscode / selenium-maven-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ardesco/selenium-maven-template

0.0 1.0 0.0 135 KB

A maven template for Selenium that will let you check out and go.

Java 100.00%

selenium-maven-template's Introduction

Selenium-Maven-Template

Join the chat at https://gitter.im/Ardesco/Selenium-Maven-Template

A maven template for Selenium 3 that has the latest dependencies so that you can just check out and start writing tests in four easy steps. If you like what you see have a look at my Selenium book Mastering Selenium Webdriver.

  1. Open a terminal window/command prompt
  2. Clone this project.
  3. cd Selenium-Maven-Template (Or whatever folder you cloned it into)
  4. mvn clean verify

All dependencies should now be downloaded and the example google cheese test will have run successfully in headless mode (Assuming you have Firefox installed in the default location)

What should I know?

  • To run any unit tests that test your Selenium framework you just need to ensure that all unit test file names end, or start with "test" and they will be run as part of the build.

  • The maven failsafe plugin has been used to create a profile with the id "selenium-tests". This is active by default, but if you want to perform a build without running your selenium tests you can disable it using:

      mvn clean verify -P-selenium-tests
    
  • The maven-failsafe-plugin will pick up any files that end in IT by default. You can customise this is you would prefer to use a custom identifier for your Selenium tests.

Known problems...

  • It looks like SafariDriver is no longer playing nicely and we are waiting on Apple to fix it... Running safari driver locally in server mode and connecting to it like a grid seems to be the workaround.

Anything else?

Yes you can specify which browser to use by using one of the following switches:

  • -Dbrowser=firefox
  • -Dbrowser=chrome
  • -Dbrowser=ie
  • -Dbrowser=edge
  • -Dbrowser=opera

If you want to toggle the use of chrome or firefox in headless mode set the headless flag (by default the headless flag is set to true)

  • -Dheadless=true
  • -Dheadless=false

You don't need to worry about downloading the IEDriverServer, EdgeDriver, ChromeDriver , OperaChromiumDriver, or GeckoDriver binaries, this project will do that for you automatically.

You can specify a grid to connect to where you can choose your browser, browser version and platform:

  • -Dremote=true
  • -DseleniumGridURL=http://{username}:{accessKey}@ondemand.saucelabs.com:80/wd/hub
  • -Dplatform=xp
  • -Dbrowser=firefox
  • -DbrowserVersion=44

You can even specify multiple threads (you can do it on a grid as well!):

  • -Dthreads=2

You can also specify a proxy to use

  • -DproxyEnabled=true
  • -DproxyHost=localhost
  • -DproxyPort=8080

If the tests fail screenshots will be saved in ${project.basedir}/target/screenshots

If you need to force a binary overwrite you can do:

  • -Doverwrite.binaries=true

It's not working!!!

You have probably got outdated driver binaries, by default they are not overwritten if they already exist to speed things up. You have two options:

  • mvn clean verify -Doverwrite.binaries=true
  • Delete the selenium_standalone_binaries folder in your resources directory

selenium-maven-template's People

Contributors

adityai avatar ardesco avatar bitwiseman avatar gitter-badger avatar hennr avatar

Watchers

 avatar

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.