Not able to switch Frame in PhantomJS but switches successfully with Firefox using selenium python

余生颓废 提交于 2019-12-11 12:27:33

问题


The following command runs successfully with Firefox Driver but with PhantomJS I am facing an error message:

driver.switch_to.frame(frame)

Error Message with PhantomJS:

errorMessage":"Unable to switch to frame"

Has anyone faced the issue previously and can help me here?


回答1:


PhantomJS/GhostDriver has this issue which has been resolved - https://github.com/detro/ghostdriver/issues/194

Below statements work with GhostDriver. There is no difference in the statements that have to be used with Ghostdriver.

driver.switchTo().frame(frame_index)
driver.switchTo().frame(frame_id)
driver.switchTo().frame(frame_object)

Put a wait until the iframe is located

wait.until(ExpectedConditions.presenceOfElementLocated("identifier of the frame"))

Make sure that the iframe is displayed in the page source.



来源:https://stackoverflow.com/questions/29385450/not-able-to-switch-frame-in-phantomjs-but-switches-successfully-with-firefox-usi

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