Software Testing Manual: Using Selenium
Lab Manual for Software Testing using Selenium
1)Understand the Automation Testing Approach(Theory concept)
2)Using Selenium IDE , write a test suite containing minimum 4 test
cases
Programming steps
I) Download the selenium IDE
Link :-https://www.selenium.dev/selenium-ide/
Click on CHROME DOWNLOAD
Click on Add to Chrome
Click on Add Extension
click on Record a new test in a new project
Write a PROJECT NAME
For example we test Rohit Sharma Wikipedia
hence we give the test name is Rohit Sharma
BASE URL (copy paste from google)
https://en.wikipedia.org/wiki/Rohit_Sharma
click on at right top cornerStart Recording
Visit website
Click on Stop Recording
Test Name
Run All Test
1
Software Testing Manual: Using Selenium
Base URL :-https://en.wikipedia.org/wiki/Rohit_Sharma
Test Run Successfully
3)Demonstrate it using a script in Java using name in Selenium server
Programming Steps:
packagerupa;
importjava.util.concurrent.TimeUnit;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.chrome.ChromeDriver;
public class second {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","C:\\seleniumDriver\\
chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://demo.guru99.com/test/login.html");
Thread.sleep(5000);
driver.manage().window().maximize();
WebElement email = driver.findElement(By.name("email"));
Thread.sleep(5000);
WebElement passwords =
driver.findElement(By.name("passwd"));
Thread.sleep(5000);
2
Software Testing Manual: Using Selenium
email.sendKeys("aishwarya");
Thread.sleep(5000);
passwords.sendKeys("xyz123");
Thread.sleep(5000);
WebElementsubmitButton =
driver.findElement(By.name("SubmitLogin"));
submitButton.click();
Thread.sleep(5000);
}
4)Demonstrate it using a script in Java using HTML Login from in
Selenium server
Programming Steps:
packagerupa;
importjava.util.concurrent.TimeUnit;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.chrome.ChromeDriver;
public class second {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","C:\\seleniumDriver\\
chromedriver.exe");
3
Software Testing Manual: Using Selenium
WebDriver driver=new ChromeDriver();
driver.get("file:///C:/Users/Admin1/Desktop/page.html");
Thread.sleep(5000);
driver.manage().window().maximize();
WebElement email = driver.findElement(By.name("uname"));
Thread.sleep(5000);
WebElement passwords =
driver.findElement(By.name("password"));
Thread.sleep(5000);
email.sendKeys("aishwarya");
Thread.sleep(5000);
passwords.sendKeys("xyz123");
Thread.sleep(5000);
WebElementsubmitButton =
driver.findElement(By.name("login"));
submitButton.click();
Thread.sleep(5000);
}
HTML From
<html>
<body>
<input type="text" placeholder="Enter Username" name="uname">
<input type="password" placeholder="Enter Password" name="password">
<div class="container">
<a href="https://www.google.com/">
<button class="btnbtn-primary btn-lg" name="login">login</button>
4
Software Testing Manual: Using Selenium
</a>
</div>
</body>
</html>
5)Demonstrate it using a script in Java using ID in Selenium server
Programming Steps:
packagerupa;
importjava.util.concurrent.TimeUnit;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.chrome.ChromeDriver;
public class second {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","C:\\seleniumDriver\\
chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://demo.guru99.com/test/login.html");
Thread.sleep(5000);
driver.manage().window().maximize();
WebElement email = driver.findElement(By.id("email"));
Thread.sleep(5000);
WebElement passwords = driver.findElement(By.id("passwd"));
5
Software Testing Manual: Using Selenium
Thread.sleep(5000);
email.sendKeys("aishwarya");
Thread.sleep(5000);
passwords.sendKeys("xyz123");
Thread.sleep(5000);
WebElementsubmitButton =
driver.findElement(By.id("SubmitLogin"));
submitButton.click();
Thread.sleep(5000);