Where we’ve followed following some easy measures & created our JUnit Selenium script:

  1. We’ve recorded a Test case using in Selenium IDE characteristic that was record.
  1. Empower Experimental Attributes from Selenium IDE choices & converted created HTML code to JUnit 4/Java/WebDriver format.
  1. In Eclipse, created “first Package” & Group under Selenium Training & pasted above automated generated code in type.
  1. One by one worked out warning messages found in code & all error.
  1. Run the Selenium training online script using JUnit in Eclipse.

Many Software Testing training readers were asking about the best way to compose selenium tutorial script without using Selenium IDE record, so we started this place & described the best way to begin composing selenium courses script by your own from scratch.

Following steps will show one to compose your own Selenium testing script:

  1. Start Eclipse IDE & create a fresh Java Job
  1. Inside just created job, create New Program called “house_page”
  1. Under recently created Program, create New Group called “OpenURL” revealed in below screenshot. The newest group is shown as “OpenURL.java”..
  1. Once group was created by you on right side of above picture you’ll the group name is shown in the code editor. Now within “OpenURL”

     5. Add “@Evaluation” annotation above procedure name “opensoftware”. You may show malfunction revealing below, after you add this annotation.

5

  1. To solve this annotation malfunction we must hover mouse over “@Evaluation” & click on option “Import ‘Test’ (org.junit)”
  1. Once you ran above statement, the newest import statement called “import org.junit. Evaluation;” will probably be added in your code revealed in below screenshot. Here we’ve imported pre-defined “Evaluation” category from JUnit framework.
  1. To run test script in selenium we must set the web browser on which we must run the test script. So here we’ve created new Item while running our test script to connect given browser. In this script we’ve chosen FireFox Browser. (Selenium videos supports different browser like Chrome, Safari etc. based on your demand you can use the browser in your test script.)
  1. Now you are going to see two malfunction in the recently extra line above screenshot. In preceding measure we’ve imported predefined type from “Webdriver” from “open.openqa.selenium” bundle into our “SoftwareTesting” Category.

To solve this error we must hover mouse over ‘Webdriver’ & click on option “Import ‘Webdriver’ (org.openqa.selenium)” link shown below screenshot:

9

Ensure that after you imported WebDriver the initial error is solved & new import statement of the code.

  1. Likewise to work out above second malfunction we need to import predefined group “FirefoxDriver” from “open.openqa.selenium.firefox”
  1. Ensure that new Import statement of Firefox Driver is added in head of all errors & the code are solved. now inbuilt FirefoxDriver Group functionality can be utilized in our “SoftwareTesting” Category.
  1. I understand you’ve got question in your mind where these line come from & what’s precise significance of the lines. So before going lets discuss significance of each below statement one

WebDriver _driver = new FirefoxDriver( );

  • WebDriver: It’s a predefined imported Group from “open.openqa.selenium”
  • driver: That is name of the brand new item created, it’s _driver id thing of Webdriver Group. To identify the things in the code we’ve added underscore prior to the item name. That is not compulsion to add this.
  • To make an item of given type, “new” java key word can be used.
  • FirefoxDriver is a Group that is predefined. FirefoxDriver( ) is a predefined constructor calling statement.
  1. Have you ever noticed that in the development statement of WebDriver thing, FirefoxDriver( ) type is used with no parameter. If no parameter is provided by us then it picks up Java application & the default option values will start the default FireFox profile. Default profile means starting FireFox in the safe mode i.e. without any extensions.
  1. Now we’ve worked out all errors found in the code. Now let us start stop & new Webpage URL the FireFox browser session.

In selenium to open the brand new url type “_driver.get”, now you are going to see new carton is opened will seven choices. Select first choice shown in below screenshot:

  1. Conserve the Selenium on webdriver Evaluation and Run the Evaluation as shown below, using JUnit:
  1. Now we’ll add next command _driver.stop( );to close the session of the FireFox Browser as shown strike:
  1. 19. Before end this place I need clarify few things. When the newest session of FireFox Browser is started while running the Selenium tutorial on webdriver Tutorial, then “WebDriver” text is shown in red colour at bottom right side of the browser.

Over to you

Maybe you have ran your Selenium with Webdriver coaching videos script? If no, then what exactly is it that you’re looking forward to, simply follow above measures that are easy & get kick off to run your first selenium training videos script. In the event you’ve got expertise on Selenium on Webdriver videos then can you please share expertise in remarks below.

In the event you like reading this post please ensure that you share it with friends and family. Please leave your questions/hints/suggestions in the comment section below and I Will try and answer as many as I could.

There are distinct JUnit annotations used like @Before, @Evaluation and @After. In this script, @Evaluation JUnit annotation has been used by us. In next post we are going to see distinct JUnit annotations used in Selenium with Webdriver script.

Leave a Reply

Your email address will not be published. Required fields are marked *