How to handle popup window using selenium webdriver with Java

人盡茶涼 提交于 2019-12-01 09:25:09

The element aContinueShopping is contained within an iframe.

You'll have to switch to the iframe using:

WebElement frameID = d1.findElement(By.Css("#add-to-cart>iframe"));
d1.SwitchTo().Frame(frameID);
d1.findElement(By.id("aContinueShopping")).click();

There's no 'name' or 'id' on the iframe, so you'll have to use a WebElement or a numeric to find it.

Once you're done with that iframe, you'll switch back to 'top' by using:

d1.SwitchTo().DefaultContent();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!