selenium create your first automation test
The following three software are prerequisite to get stared with selenium.
- Java => Environment and programming language to write script
- Eclipse => To run script
- selenium => Framework to test script
- WebDriver => To run test in specific browser.
1. Java.
Download java by clicking here and download latest JRE file according to you OS. After installing java add Environment variable to Jdk/Bin folder in my case it is C:\Program Files\Java\jdk-11.0.2\bin.
2 . Eclipse
Download the eclipse from official website or click here.
3.selenium
Go to selenium website by clicking here to download latest or download to download any previous version click here. I went to 3.9 folder and downloaded two files.
- selenium-server-standalone-3.9.1.jar
- selenium-server-3.9.1.zip
Extract the zip in empty folder it will contain 2 jar file and some jar files in Lib folder we will need while setting up environment for Eclipse.
4. WebDrivers.
Go to seleniumhq website and navigate to Third Party Browser Drivers section and download the drivers according to your browser version.
Now we setup Eclipse environment so first lunch the eclipse and create java project and follow the steps.
- Right click on JRE System Library.
- Click Build Path in new window and select configure build path as show in image

- A new window will be open click on ClassPath it will enable "Add External Jars" option click on it.

- Add selenium-server-standalone-3.9.1.jar which and downloaded while and also select all jar files from Libs folder and two root jar files which were extracted from selenium-server-3.9.1.zip.
- Click on Apply and close. That's it we are done with setup.
Now create the new package in your project by clicking on Src folder and paste the following code in and change the class and package name and also location of webDriver from to E:\\automation\\chromedriver.exe to your own browser driver location which was downloaded on step 4. After it you can run your first test by clicking on RUN button.
package demo.packag;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class demoClass {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E:\\automation\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.gmail.com");
}
}
You can also take help from This link
For Element selector click here
action type select information click here
You can also take help from This link
For Element selector click here
action type select information click here
Comments
Post a Comment