admin管理员组文章数量:1429571
Change iframe works fine with Firefox webdriver and Chrome web driver but not with the Microsoft Edge Driver. All the other tests are working fine in Edge, but not changing iframes. I updated the Edge driver and Windows 10 because it's a known issue, but this still has not resolved my problem. Is there any other way to fix this?
driver.switchTo().defaultContent();
driver.switchTo().frame("settingiframe");
driver.findElement(By.id("LibraryConfigurations")).click();
Out e message will be : no such element found
Change iframe works fine with Firefox webdriver and Chrome web driver but not with the Microsoft Edge Driver. All the other tests are working fine in Edge, but not changing iframes. I updated the Edge driver and Windows 10 because it's a known issue, but this still has not resolved my problem. Is there any other way to fix this?
driver.switchTo().defaultContent();
driver.switchTo().frame("settingiframe");
driver.findElement(By.id("LibraryConfigurations")).click();
Out e message will be : no such element found
Share Improve this question edited Feb 7, 2017 at 2:56 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked Jul 5, 2016 at 11:29 pasindu sanjepasindu sanje 131 gold badge1 silver badge6 bronze badges 3- check this...stackoverflow./questions/10879206/… – Amol Chavan Commented Jul 5, 2016 at 11:48
- Code is working on normal browsers but not in edge... – pasindu sanje Commented Jul 5, 2016 at 12:09
- I suggest, first try finding frame element and then try switching to it. – Amol Chavan Commented Jul 5, 2016 at 12:14
1 Answer
Reset to default 2You need to implement WebDriverWait
to wait for frame available then switch like as below :-
WebDriverWait wait = new WebDriverWait(driver,20);
driver.switchTo().defaultContent();
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("settingiframe"));
//after successfully switching to frame you need to wait until element to be clickable
WebElement el = wait.until(ExpectedConditions.elementToBeClickable(By.id("LibraryConfigurations")));
el.click();
Note :- The above code will wait
for a given frame
up to 20 seconds. If the frame
will be available within given time, it will switch to the given frame
. Otherwise, it will throw TimeoutException
.
Hope it will help you...:)
本文标签: javascriptHow to fix iframes not working with Microsoft EdgeStack Overflow
版权声明:本文标题:javascript - How to fix iframes not working with Microsoft Edge? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745418852a2657811.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论