javascript - How to fix iframes not working with Microsoft Edge? - Stack Overflow

Change iframe works fine with Firefox webdriver and Chrome web driver but not with the Microsoft Edge D

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
Add a ment  | 

1 Answer 1

Reset to default 2

You 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...:)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745418853a4626875.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信