Reputation: 13
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.
Upvotes: 1
Views: 137
Reputation: 193338
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();
Upvotes: 1