How to switch iframes InternJS

浪尽此生 提交于 2019-12-06 20:42:24

Depending on how your iframes are setup on the page you could try something like this:

    .switchToFrame(null)
    .findAllByClassName('iframe')
    .then(
      function(iframes) {
         new remote.constructor(remote.session)
        .switchToFrame(iframes[iframes.length-1])
      }
    )

This assumes that the iframe you want to switch to is last to be found, which is obviously a big assumption. You might be able to tweak this though, if the dynamically created iframes appear in the same order every time.

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