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.
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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.