【问题标题】:Selenium Robot Framework Pop Up AccessSelenium Robot Framework 弹出访问
【发布时间】:2017-02-07 22:02:26
【问题描述】:

我无法使用selenium webdriver 机器人框架访问弹出窗口。

步骤:

  1. 网站“http://carlightking.com/
  2. 点击“按车辆搜索”选项卡。\
  3. 弹出窗口打开

我尝试使用带有idname 等定位器的“选择窗口”关键字访问弹出窗口,但没有成功。它显示了

ValueError: Window locator with prefix 'id' is not supported.

如何选择这个弹出窗口并访问上面的元素?

【问题讨论】:

    标签: selenium robotframework


    【解决方案1】:

    问题在于弹出窗口位于 iFrame 内。

    <iframe id="popup_selector" src="//carlightking.com/selector/selector-home-popup.php" width="100%"></iframe>
    

    因此您必须首先明确选择 iframe

    *** Test Case ***
    CarLightKing
            Open Browser    http://carlightking.com/
            Wait Until Page contains Element            link=Search by Vehicle        5s
            Click Element           link=Search by Vehicle 
            Select Frame            id=popup_selector
    

    【讨论】:

    • Vivi,我尝试使用定位器选择框架内的元素,例如 id = "drop_1" 和 xpath = //*[@id="drop_1"]。但我做不到。您能否建议我应该如何选择 ifrmae 中的元素。另外我应该在哪里阅读更多关于它的信息,因为我刚刚开始学习它。
    猜你喜欢
    • 1970-01-01
    • 2018-12-13
    • 2020-04-09
    • 2016-09-17
    • 2023-01-20
    • 2013-01-01
    • 1970-01-01
    • 2012-02-19
    相关资源
    最近更新 更多