试步骤 1. 打开百度页面 2. 登录一个已有的百度帐号,并验证登录成功 3. 修订搜索设置(登录按钮旁边的设置按钮),并验证设置结果 a.不显示天气预报 b.搜索结果在新窗口打开 4.搜索内容 [福...

以下是使用Robot Framework编写的测试脚本,其中包含了测试步骤、测试说明、测试过程和测试结果验证,并且每个测试步骤都有相应的关键字进行调用。该脚本可以完成打开百度页面、登录百度账号、修改搜索设置、搜索天气并验证、打开天气页面并输出天气和温度信息的功能,并且会生成log文件和截图供查看。

```robotframework *** Settings *** Documentation 测试百度搜索天气功能 Library SeleniumLibrary Library OperatingSystem Library DateTime

*** Variables *** ${BROWSER} Chrome ${URL} http://www.baidu.com ${USERNAME} your_username ${PASSWORD} your_password ${SEARCH_TEXT} 福州天气 ${EXPECTED_WEATHER} 晴 ${EXPECTED_TEMPERATURE} 10℃ ${SCREENSHOT_PATH} results/screenshots

*** Test Cases *** 测试搜索天气功能 打开百度页面 登录百度账号 修订搜索设置 搜索天气 验证搜索结果 打开天气页面并输出天气信息

*** Keywords *** 打开百度页面 [Documentation] 打开百度首页 Open Browser ${URL} ${BROWSER} Maximize Browser Window Title Should Be 百度一下,你就知道

登录百度账号 [Documentation] 登录一个已有的百度账号 Click Link 登录 Wait Until Page Contains Element id:TANGRAM__PSP_10__footerULoginBtn Click Button id:TANGRAM__PSP_10__footerULoginBtn Input Text id:TANGRAM__PSP_10__userName ${USERNAME} Input Password id:TANGRAM__PSP_10__password ${PASSWORD} Click Button id:TANGRAM__PSP_10__submit

修订搜索设置 [Documentation] 修改搜索设置,不显示天气预报,搜索结果在新窗口打开 Click Button id:s-usersetting-top Wait Until Page Contains Element link=搜索设置 Click Link 搜索设置 Wait Until Page Contains Element id:se-setting-2 Unselect Checkbox id:se-setting-2 Select Radio Button xpath=//input[@name='s_otn']/following-sibling::label[text()='在新窗口打开']

搜索天气 [Documentation] 搜索福州天气 Input Text id:kw ${SEARCH_TEXT} Press Keys id:kw RETURN

验证搜索结果 [Documentation] 验证搜索结果是否正确 Wait Until Page Contains ${SEARCH_TEXT} Capture Page Screenshot ${actual_weather}= Get Text css:.op_weather4_twoicon_today .wea ${actual_temperature}= Get Text css:.op_weather4_twoicon_today .tem Should Be Equal ${actual_weather} ${EXPECTED_WEATHER} Should Be Equal ${actual_temperature} ${EXPECTED_TEMPERATURE}

打开天气页面并输出天气信息 [Documentation]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值