使用 Robot 框架和 Selenium2Library 处理 iframe 时遇到问题。它抛出错误:
WebDriverException: Message: unknown error: unhandled inspector error: {"code":-
32000,"message":"Cannot find context with specified id"}
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64)
我的测试代码是:
Fill In Description ${description}
Wait Until Element Is Visible ${FRAME} 40
Select Frame ${FRAME}
wait until page contains element ${IFRAME BODY}
Click Element ${IFRAME BODY}
wait until page contains element ${IFRAME BODY}
Clear Element Text ${IFRAME BODY}
wait until page contains element ${IFRAME BODY}
Input Text ${IFRAME BODY} ${description}
Unselect Frame
一步失败Input Text ${IFRAME BODY} ${description}
顺便说一句,我将此关键字用于出现此 iframe 的更多页面,但仅在一次确切的情况下失败 - 但所有 iframe 的 html 代码都是相同的,所以真的不明白为什么它有时会起作用..
会很高兴得到任何帮助。