Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import org.testng.annotations.BeforeTest;
- import org.testng.annotations.Test;
- import java.util.concurrent.TimeUnit;
- public class FirstTest {
- @Test
- public void testCurrentUrl() {
- WebDriver driver = new ChromeDriver();
- driver.manage().window().maximize();
- driver.get("https://google.com.ua");
- driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
- WebElement searchInput = driver.findElement(By.xpath("//input[@class='gLFyf gsfi']"));
- // WebElement searchInput = driver.findElement(By.xpath("/html/body/div[2]/div[2]/form/div[2]/div[1]/div[1]/div/div[2]/input"));
- searchInput.click();
- searchInput.sendKeys("java приколы");
- WebElement searchingInput = driver.findElement(By.xpath("//center/input[@class='gNO89b']"));
- // WebElement searchingInput = driver.findElement(By.xpath("/html/body/div[2]/div[2]/form/div[2]/div[1]/div[2]/div[2]/div[2]/center/input[1]"));
- searchingInput.click();
- WebElement firstLink = driver.findElement(By.xpath("//h3[@class='LC20lb DKV0Md']"));
- firstLink.click();
- driver.quit();
- }
- }
Add Comment
Please, Sign In to add comment