【问题标题】:Robot Framework cant find the element via SeleniumLibraryRobot Framework 无法通过 SeleniumLibrary 找到元素
【发布时间】:2021-03-21 11:58:11
【问题描述】:

我想点击 google.com 上的按钮。但它显示Element '//input[@name="btnI"]' not visible after 5 seconds.。有人知道怎么做吗?

我也试过先输入搜索字符串然后点击按钮,效果很好。

*** Settings ***
Documentation       Robot Framework Example
Library             SeleniumLibrary
Library             OperatingSystem

Suite Setup         Open Browser    https://www.google.com/   chrome
Suite Teardown      Close Browser

*** Variables ***

*** Test Cases ***
My Test
    Search Web

*** Keywords ***
Click Doodle Button
    [Documentation]    Click button
    Wait Until Element Is Visible   //input[@name="btnI"]
    Click Element   //input[@name="btnI"]    

Search Web
    [Documentation]    Search Web
    Click Doodle Button

【问题讨论】:

    标签: selenium-webdriver automated-tests robotframework


    【解决方案1】:
    Wait Until Element Is Visible   (//input[@name="btnI"])[2]
    Click Element   (//input[@name="btnI"])[2] 
    

    有两个元素,正确的元素是第二个,使用上面的定位器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-03
      • 1970-01-01
      • 2020-05-17
      • 2021-04-22
      • 1970-01-01
      • 2022-07-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多