1

I am trying to click on the "NO THANKS" in the iframe but keep getting "Expected condition failed: waiting for frame to be available"

My code:

WebDriver driver = new ChromeDriver();
                                    
driver.get("http://www.qaclickacademy.com");

new WebDriverWait(driver,40).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt
(By.xpath("//div[@class='sumome-react-wysiwyg-popup-animation-group']")));
driver.findElement(By.xpath("//div[@class='sumome-react-wysiwyg-popup-animation-group']/span/div/div[6]/div//div/button")).click();

It does take some time for the iframe to popup after initial load of page but I had wait at 20,30,40 and 60 and it just doesn't work.

1 Answer 1

1

The element isn't with in any <iframe>.

To click on the element NO THANKS you need to induce WebDriverWait for the elementToBeClickable() and you can use the following Locator Strategy:

  • Using XPATH:

    driver.get("http://www.qaclickacademy.com")
    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='NO THANKS']"))).click();
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.