Tuesday, March 28, 2017

Integration of selenium Jars and first test case with Selenium

Step 1: Download web driver java client from the location.












Step 2: Extract the zip file, place all the jar files where you want to maintain your test wares.







Step 3: Launch eclipse, create a new workspace, and create a new project









Step 4: Select “Java Project”. Give a project name “AutomationForDummy”.

Step 5: Create a new package and then create a new class.





























Step 6: Add external Jars to java build path

Right click on project > select properties > Java build path > Libraries tab > click “Add External JARs”.
  • Add selenium Java jar
  • Add all other jars in libs folder













Step 7: Add following code in your class

       WebDriver driver = new FirefoxDriver();
             
       //Launch the google search engine
       driver.get("http://www.google.com");

       // Print a Log In message to the screen
       System.out.println("Successfully opened google search page");

       //Wait for 5 sec
             
       Thread.sleep(5);
                          
       // Close the driver
       driver.quit();

Step 8: Right click on the window > Run as > Java Application

See the result.


No comments:

Post a Comment