Monday, July 18, 2016

AUTOMATION 17 - GUI 5, Setting up a Selenium project

Technical level: ****

Last time we installed everything we needed for Selenium WebDriver.  Before we can try out some instructions, we need to set up our Java project area, including importing the Selenium JAR library.


Creating your project

First you need to setup your project area ...

From the menu select File -> New -> Project



Select Java Project, then Next

 
Set a project name as project Aardvark & select Finish


 Your project is now all set up.

 


Create a (main) Java class

Now you need to define the main Java class for your project...

Now, right click it an select New -> Class



From the Java Class select “public static void main (String[] args)" checkbox, type a Name of “PageChecker” then Finish.  This sets up a main function in the Java class, which is central to being able to run your script when you’re ready.


Once finished it should look like,



Link in the Selenium JAR libraries

Now need to add in the Selenium JARs we downloaded last time...

Right click on Project Aardvark and then Build Path -> Configure Build Path



Select the Libraries tab and Add External JARs


 Add in ALL the .jar files you downloaded from Selenium and extracted into your Documents folder – including those in the libs files …



Then select OK.

You should now save your project area – you’re ready for your first automated check, which we'll cover next time.

New Step - Bring in the browser driver Added 22/08/16

Since this post was originally printed, there have been some changes which have impacted how WebDriver works.  Read about it here.

It used to be that you could operate Firefox out-of-the-box.  Now you need to bring in Gecko driver executable and bring it into the folder you have your PageChecker project in.

You can download the drivers from here - but as the page says, be aware that they are third party drivers!



4 comments:


  1. Gclub You will become a billionaire.

    จีคลับ Betting Online Betting The newest channel you can become a millionaire just by winning over online gambling is just getting rich. And for playing games, online gambling is another fun channel where you can join a simple part that you subscribe to our online casino site will only know that the creation of the. On the website of this online casino is easy.

    And when you know this, then do not forget to join our fun online gambling games. And when you know this. Do not forget to join the fun with the game of online gambling, because the truth on the online casino website is a challenge to your ability.

    And if you are thinking to make money for yourself, do not forget to join the fun and choose to play games online with us. You can play 24 hours a day. บาคาร่า

    ReplyDelete
  2. It's not often that I read such good posts.
    adult service

    ReplyDelete
  3. Nice blog with actual content. Information on your blog facilitates practical knowledge.
    Thanks
    Offshore dedicated server

    ReplyDelete