Skip to content Skip to sidebar Skip to footer

Selenium - I Can't Click Button In Dialog "before You Continue" In Google

I have a problem , click button in dialog forms in google. This is my code : @BeforeEach public void startDriver() throws InterruptedException { // Start Chrome browser Sys

Solution 1:

Add this: driver.switchTo().frame(0);

before that: WebElement agree = driver.findElement(By.id("introAgreeButton"));

The button is in iframe and driver can't find it.

Solution 2:

You can also add this: driver.wait(until.ableToSwitchToFrame(0)); instead Thread.sleep(4000);driver.switchTo().frame(0);

It will switch automatically

Post a Comment for "Selenium - I Can't Click Button In Dialog "before You Continue" In Google"