I need help with clicking a button in dialog forms on Google. Here is the code I am using:
@BeforeEach
public void startDriver() throws InterruptedException {
// Start Chrome browser
System.setProperty("webdriver.chrome.driver", "C:\\gecko\\chrome\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.google.pl/?gws_rd=ssl");
}
@Test
@DisplayName("Test strony google")
public void testGoogle() throws InterruptedException, IOException {
System.out.println("Rozpoczecie testu strony google");
ModelStatistic modelStatistic = new ModelStatistic();
System.out.println(modelStatistic.getTimestamp());
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Thread.sleep(4000);
WebElement agree = driver.findElement(By.id("introAgreeButton"));
agree.click();
Thread.sleep(3000);
WebElement name = driver.findElement(By.cssSelector("input[name='q']"));
name.sendKeys("Kamil Surma");
}
Selenium is unable to locate the agree Webelement.
I agree