0

我在尝试打开浏览器时遇到问题。我在 RIDE 中编写测试,当我运行测试时,浏览器打开但不显示页面......

浏览器只显示一条消息:“连接已超时”

有人遇到过这个问题吗?

这是代码:

    *** Settings ***
Library           Selenium2Library

*** Variables ***
${Username}       student2
${Password}       Testing1
${SiteUrl}        http://demo.mahara.org
${DashboardTitle}    Dashboard - Mahara
${Delay}          5s

*** Test Cases ***
Test2
    Open Browser to the Login Page
    Enter User Name
    Enter Password
    Click Login
    sleep    $(Delay)
    Assert Dashboard Title
    [Teardown]    Close Browser

*** Keywords ***
Open Browser to the Login Page
    Open Browser    http://demo.mahara.org

Enter User Name
    Input Text    login_login_username    ${Username}

Enter Password
    Input Text    login_login_password    ${Password}

Click Login
    Click Button    login_submit

Assert Dashboard Title
    Title Should Be    ${DashboardTitle}

顺便说一句,Firefox 版本:31.0 selenium 版本:2.53.6 selenium2Library 版本:1.7.4

有什么解决办法吗?提前致谢 ;)

4

1 回答 1

0

这是工作代码:

*** Settings ***
Library           Selenium2Library

*** Variables ***
${Username}       student2
${Password}       Testing1
${SiteUrl}        http://demo.mahara.org
${DashboardTitle}    Dashboard - Mahara
${Delay}          5s
${FF_PROFILE}     C:\\ff_profile

*** Test Cases ***
Test2
    Open Browser to the Login Page
    Enter User Name
    Enter Password
    Click Login
    Sleep    ${Delay}
    Assert Dashboard Title
    [Teardown]    Close Browser

Test3

*** Keywords ***
Open Browser to the Login Page
    Open Browser    http://demo.mahara.org    firefox    ff_profile_dir=${FF_PROFILE}

Enter User Name
    Input Text    login_login_username    ${Username}

Enter Password
    Input Text    login_login_password    ${Password}

Click Login
    Click Button    login_submit

Assert Dashboard Title
    Title Should Be    ${DashboardTitle}
于 2016-07-13T06:45:20.283 回答