Reputation: 89
I am quite new to Selenium Web driver and I suppose this is a basic question. Anyway, I am having troubles in switching to a quick view window. Let me explain this with the image below
We got this by visiting amazon.com and hit "Quick look" on any item. Now, suppose I want to click on the button "See product details", how can I do this?
Do I have to accept the alert and then click? Like this java code for example
driver.switchTo().alert().accept();
driver.findElement(By.xpath("xpath")).click();
I tried this and does not work. How can handle situations like this? Any idea?
Thanks a lot.
Upvotes: 0
Views: 2748
Reputation: 52665
"Quick look" modal window is not an alert. You just need to wait until it appeared in DOM. Try to add below code to your existed after you clicked "Quick look" button:
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.linkText("See product details"))).click();
Upvotes: 3