机器人框架中的目标动态输入元素

时间:2018-01-30 14:36:44

标签: selenium robotframework

我是编程/测试世界以及stackoverflow的新手。请放轻松! :)

所以我正在尝试编写我的第一个机器人框架测试,我试图填写gmail

的注册页面

target page screenshot enter image description here

我的问题是,我动态生成的这个页面是没有固定的输入框,我可以定位,在搜索在线定位css / xpath之后尝试了几种方法来填写但没有工作

这是我到目前为止所写的内容:

*** Settings ***
Documentation    this is basic test case
Library          Selenium2Library

*** Variables ***


*** Test Cases ***

user have to create gmail account
    [Documentation]    first user have to register in gmail

    open browser                   https://www.google.com/gmail/about/       firefox
    click element                  xpath=/html/body/nav/div/a[3]
    ${nam}                         get text   css:input#FirstName

控制台输出(错误)

(robo-fm) my-lappy:robo-fm lappy$ robot -d Results  Tests/gmail.robot 
==============================================================================
Gmail :: this is basic test case                                              
==============================================================================
user have to create gmail account :: first user have to register i... | FAIL |
Element with locator 'css:input#FirstName' not found.
------------------------------------------------------------------------------
Gmail :: this is basic test case                                      | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================

我正在python使用mozilla作为测试浏览器的测试环境脚本。
请让我知道正确方向的任何指示。谢谢!

0 个答案:

没有答案