Git Basic Commands
Git Basic Commands
@Test
public void testGoogleSearch() {
// Set the path to the ChromeDriver executable
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
// Open Google
driver.get("https://www.google.com");
// Perform a search
driver.findElement(By.name("q")).sendKeys("Selenium WebDriver");
driver.findElement(By.name("q")).submit();
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
driver.get("http://127.0.0.1:5500/index.html");
WebElement login =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[1]"));
login.click();
WebElement signup =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[2]"));
signup.click();
WebElement title =
driver.findElement(By.xpath("/html/body/div/header/div/nav/a/span"));
String value = title.getText();
System.out.print(value);
String value2 = "User Management and Administration";
if(value.equals(value2)) {
System.out.print(" Equal");
}
else {
System.out.print(" not equal");
}
WebElement login_new =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[1]"));
login_new.click();
WebElement user =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[1]/
input"));
user.sendKeys("Taher");
WebElement pass =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[2]/
input"));
pass.sendKeys("admin");
WebElement login_validate =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[3]/
button"));
login_validate.click();
WebElement signup_new =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[2]"));
signup_new.click();