Class File
import io.github.bonigarcia.wdm.WebDriverManager;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.edge.*;
public class Test {
public static void main(String[] args) throws InterruptedException {
WebDriverManager.edgedriver().setup();
WebDriver driver = new EdgeDriver();
driver.get("https://www.google.co.in/");
driver.manage().window().maximize();
WebElement textbox = driver.findElement(By.name("q"));
textbox.sendKeys("harsh");
List<WebElement> list = driver.findElements(By.xpath("//input[@name='btnK']"));
driver.findElement(By.xpath("//*[@alt = 'Google']")).click();
Thread.sleep(1000);
driver.findElement(By.xpath("//*[@class='FPdoLc lJ9FBc']//input[@name='btnK']")).click();
//System.out.println(list);
Thread.sleep(1000);
driver.navigate().back();
driver.close();
}
}
Comments
Post a Comment