【发布时间】:2019-06-24 01:57:21
【问题描述】:
我有这个测试用例:
Select Frame id=coach_frame63454108.cf1
Wait Until Element Is Visible ${ap.gui.header.appname}
Page Should Contain Element ${ap.gui.header.appname}
Page Should Contain Element ${ap.gui.header.appnum}
Page Should Contain Element ${ap.gui.header.procnum}
但总是出现以下错误:
Element with locator 'coach_frame63454108.cf1' not found.
iframe HTML 代码是:
<iframe id="coach_frame63454108.cf1" style="border: 0px; height: 100%; width: 100%; display: block" title="Verify Application"></iframe>
谁能帮帮我。
【问题讨论】:
-
尝试切换而不是选择,因为它是一个框架,或者如果
.有问题,您可以尝试使用其他一些定位器,如xpath -
@AliCSE 我已经尝试过其他定位器,结果是一样的。如何切换而不是选择
-
你可以这样试试
driver.switch_to.frame(driver.find_element_by_xpath("//iframe[contains(@id, 'coach_frame')]"')) -
要再次切换回主窗口,您可以尝试
driver.switch_to.default_content() -
欲了解更多信息Refer This Link
标签: css selenium robotframework