Advanced Software Testing lab
Selenium Web driver exercise
NAME:GUNASEKHAR R
REG NO:16MIS1175
1st
package astlab;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class program1 {
public static void main(String args[] ){
System.setProperty("webdriver.gecko.driver","C:\\software\\geckodriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://moodlecc.vit.ac.in/");
driver.findElement(By.partialLinkText("Forgotten")).click();
driver.findElement(By.partialLinkText("mobile")).click();
WebDriver driver2 = new FirefoxDriver();
driver2.get("https://www.caterpillar.com/en.html");
Select drpCountry = new Select(driver.findElement(By.xpath("/html/body/form/select")));
drpCountry.selectByVisibleText("HTML");
}
}
Second &Third
package astlab;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class PROGRAM2 {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\software\\geckodriver\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
driver.get("https://moodlecc.vit.ac.in/login/index.php");
System.setProperty("webdriver.gecko.driver","C:\\software\\geckodriver\\geckodriver.exe");
WebDriver driver1 =new FirefoxDriver();
driver.get("https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert");
driver.switchTo().alert().accept();
System.setProperty("webdriver.chrome.driver","C:\\software\\geckodriver\\chromedriver.exe");
WebDriver driver2 =new ChromeDriver();
driver1.get("https://www.hotstar.com/in");
}
}