无法在PhantomJS中切换框架,但使用硒Python在Firefox上成功切换 [英] Not able to switch Frame in PhantomJS but switches successfully with Firefox using selenium python
问题描述
以下命令在Firefox驱动程序中成功运行,但在PhantomJS中却遇到错误消息:
The following command runs successfully with Firefox Driver but with PhantomJS I am facing an error message:
driver.switch_to.frame(frame)
PhantomJS错误消息:
Error Message with PhantomJS:
errorMessage":"Unable to switch to frame"
以前有人遇到过这个问题,可以在这里帮助我吗?
Has anyone faced the issue previously and can help me here?
推荐答案
PhantomJS/GhostDriver已解决此问题- https://github.com/detro/ghostdriver/issues/194
PhantomJS/GhostDriver has this issue which has been resolved - https://github.com/detro/ghostdriver/issues/194
以下语句可用于GhostDriver.必须与Ghostdriver一起使用的语句没有区别.
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)
等待直到找到iframe
Put a wait until the iframe is located
wait.until(ExpectedConditions.presenceOfElementLocated("identifier of the frame"))
确保iframe显示在页面源中.
Make sure that the iframe is displayed in the page source.
这篇关于无法在PhantomJS中切换框架,但使用硒Python在Firefox上成功切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!