Selenium Environment Setup

Selenium Test Environment Setup, Choose Software, Install Eclipse IDE, Download & Install Java, Add Selenium jar file to the Java Project.

Selenium Test Environment Setup

Selenium is not an all-inclusive test tool, it requires third-party frameworks & plugins to broaden the scope of testing. So first choose Selenium Tools and Other Software for Testing.

Example: Eclipse IDE as Editor for writing Test Scripts, Java for Programming, and TestiNG as Test Runner.

1. Selenium Installation Steps:

1. Download & Install Java Software (JDK) – create and execute programs/test scripts
2. Set Environment Variable path (Path variable) – to use Java software from any directory
3. Download Eclipse IDE and extract – to write and execute Java programs, add software components…
4. Download Selenium WebDriver Java language binding (from www.seleniumhq.org) and add WebDriver jar files to the Java project in Eclipse IDE.
5. Download Browser driver/s and set browser path in test cases (instantiate Browser driver)
6. Download TestNG plugin & Install in Eclipse IDE.

Navigation to add Selenium jar files to Java Project in Eclipse IDE,

• Launch Ellipse IDE
• Create Java Project /Select Java Project and right Click
• Build path
• Configure Build path
• Select the “Libraries” tab
• Add “External jars”
• Browse path of the WebDriver jar files and Add
• Apply

2. Write first Selenium Test Case & Execute:

Manual Test Case:

Test Case ID: gcrShop_admin_TC001

Test Case Name: Verify Admin Login into gcrShop Application Admin Interface

Test Steps:
1. Launch Browser
2. Navigate to gcrShop Admin Interface (“http://gcreddy.com/project/admin/login.php”)
3. Enter valid Username
4. Enter valid Password
5. Click Login
…………………….
Input Data: gcreddy
Password: Temp@2020

Verification Point:
Capture the current URL after Login and compare with expected

Expected URL:
“http://gcreddy.com/project/admin/index.php”

Actual: * After Execution

Test Result: Pass/Fail (* After Execution)
……………………………………………………………..
Inspect Elements:
i) Username – Edit Box – name – username
ii) Password – Edit Box – name – password
iii) Login – Button – id- tdb1
……………………………………………………………..
Download Browser driver/s and Instantiate in your Test Case

Selenium Test Case

public class AdminLogin {

public static void main(String[] args) throws InterruptedException {

//Instantiate Chrome Browser Driver
System.setProperty(“webdriver.chrome.driver”, “E:/chromedriver.exe”);

//Create Chrome Browser Driver
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();

driver.get(“http://gcreddy.com/project/admin/login.php”);
driver.findElement(By.name(“username”)).sendKeys(“gcreddy”);
driver.findElement(By.name(“password”)).sendKeys(“Temp@2020”);
driver.findElement(By.id(“tdb1”)).click();
Thread.sleep(23000);
String url = driver.getCurrentUrl();

if (url.contains(“http://gcreddy.com/project/admin/index.php”)){
System.out.println(“Admin Login is Successful -Passed”);
}
else
{
System.out.println(“Admin Login is Unsuccessful – Failed”);
}
driver.close();

}
}


Manual Testing Tutorial

Java Tutorial

Python Tutorial

SQL Tutorial

Selenium, Java, and Testing Videos

Follow me on social media: