Selenium2Library实现基于GUI的测试

1885 篇文章 51 订阅
659 篇文章 1 订阅

2024软件测试面试刷题,这个小程序(永久刷题),靠它快速找到工作了!(刷题APP的天花板)_软件测试刷题小程序-CSDN博客文章浏览阅读3.4k次,点赞86次,收藏15次。你知不知道有这么一个软件测试面试的刷题小程序。里面包含了面试常问的软件测试基础题,web自动化测试、app自动化测试、接口测试、性能测试、自动化测试、安全测试及一些常问到的人力资源题目。最主要的是他还收集了像阿里、华为这样的大厂面试真题,还有互动交流板块……_软件测试刷题小程序​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502​编辑https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502icon-default.png?t=N7T8https://blog.csdn.net/AI_Green/article/details/134931243?spm=1001.2014.3001.5502

设置

程序库               Selenium2Library
变量文件              var.py

变量

@{words}          软件测试    大数据    云计算    C++    Java    Python    编译原理    数据库    软件工程

用例

访问百度  ​​​​​​​

    open browser    https://www.baidu.com    firefox
    ${SearchWords}    Set Variable    软件测试
    Input Text    name=wd    ${SearchWords}
    Click Button    id=su
    Wait Until Element Is Visible    class=n    20
    ${title}    Get Title
    Should be Equal    ${title}    ${SearchWords}_百度搜索
    Close Browser

切换iframe  ​​​​​​​

    open browser    http://www.3testing.com/    firefox
    Select Frame    xpath=/html/body/iframe[1]
    Click link    id=introduce
    Page Should Contain    顾翔
    Close Browser

切换windows ​​​​​​​

    open browser    https://www.baidu.com    firefox
    Click link    name=tj_briicon
    ${handles}    Get Window Handles
    Switch Window    ${handles[0]}
    Close Window
    Switch Window    ${handles[1]}
    Wait Until Element Is Visible    xpath=//*[@id="content"]/h3[1]    20
    Page Should Contain    文心一言
    Close Window
    Close Browser

移动鼠标   ​​​​​​​

    open browser    https://www.baidu.com    firefox
    ${SearchWords}    Set Variable    软件测试
    Input Text    name=wd    ${SearchWords}
    Click Button    id=su
    Wait Until Element Is Visible    class=n    20
    ${title}    Get Title
    Should be Equal    ${title}    ${SearchWords}_百度搜索
    Mouse Over    name=tj_settingicon
    Click link    class=last
    Page Should Contain    隐私设置
    Close Browser

键盘操作  ​​​​​​​

    open browser    https://www.baidu.com    firefox
    ${SearchWords}    Set Variable    软件测试
    Input Text    name=wd    ${SearchWords}
    Press Key    id=su    Keys.ENTER
    Wait Until Element Is Visible    class=n    20
    ${title}    Get Title
    Should be Equal    ${title}    ${SearchWords}_百度搜索
    ${SearchWords}    Set Variable    大数据
    Input Text    name=wd    ${SearchWords}
    Press Key    id=su    \\10
    Wait Until Page Contains    ${SearchWords}    20
    ${title}    Get Title
    Should be Equal    ${title}    ${SearchWords}_百度搜索
    Close Browser

电子商务网站操作   ​​​​​​​

    open browser    http://127.0.0.1:8000 firefox
    Input Text    name=username    cindy
    Input Text    name=password    123456
    Submit Form    name=myForm
    Wait Until Element Is Visible    name=good    20
    ${title}    Get Title
    Should be Equal    ${title}    电子商务系统
    Close Browser

cookies操作   ​​​​​​​

    open browser    http://127.0.0.1:8000/    firefox
    Input Text    name=username    cindy
    Input Text    name=password    123456
    Submit Form    name=myForm
    Wait Until Element Is Visible    name=good    20
    ${title}    Get Title
    Should be Equal    ${title}    电子商务系统
    Add Cookie    1    1
    Add Cookie    2    2
    go to    http://127.0.0.1:8000/goods_view/
    Page Should Contain    查看购物车2
    click link    /view_chart/
    Element Should Be Visible    xpath=/html/body/div[2]/div[1]/div/table/tbody/tr[1]/td[4]/form
    Close Browser

单复选框   ​​​​​​​

    open browser    http://127.0.0.1:8080/sec/33/index.html    firefox
    Click Element    xpath=//input[@type='radio' and @value='Traditional_Chinese']
    Element Should Be Focused    xpath=//input[@type='radio' and @value='Traditional_Chinese']
    ${condition}    Get Element Attribute    id=c1    @checked
    Run Keyword If    '${condition}' == 'true'    Log    复选框已被选中
    ...    ELSE    Click Element    id=c1
    Checkbox Should Be Selected    id=c1
    Close Browser

选择复选框中所有内容   ​​​​​​​

@{list}    Create List    1    2    3
    open browser    http://127.0.0.1:8080/sec/33/index.html    firefox
    @{checkboxes}    Get Webelements    xpath=/html/body/form[2]
    FOR    ${item}    IN    @{list}
        Click Element    id=c${item}
    END
    FOR    ${item}    IN    @{list}
        Checkbox Should Be Selected    id=c${item}
    END
    Close Browser

下拉条   ​​​​​​​

open browser    http://127.0.0.1:8080/sec/32/index.html    firefox
    sleep    3
    Select From List By Value    id=ph    华为
    Click Button    id=button
    Alert Should Be Present    我选择的是华为
    Select From List By Label    id=ph    中兴
    Click Button    id=button
    Alert Should Be Present    我选择的是中兴
    Close Browser

关键字   ​​​​​​​

 open browser    https://www.baidu.com    firefox
    ${SearchWords}    Set Variable    ${words}[${integer}]
    Input Text    name=wd    ${SearchWords}
    Click Button    id=su
    Wait Until Element Is Visible    class=n    20
    ${title}    Get Title
    Should be Equal    ${title}    ${SearchWords}_百度搜索
    Close Browser

var.py​​​​​​​

import random
__all__ =['scalar','var1','integer','words']
scalar = 'Hello World!'
var1 =['Hello','World','Python']
integer = random.randint(0,8)

行动吧,在路上总比一直观望的要好,未来的你肯定会感谢现在拼搏的自己!如果想学习提升找不到资料,没人答疑解惑时,请及时加入群: 759968159,里面有各种测试开发资料和技术可以一起交流哦。

最后: 下方这份完整的软件测试视频教程已经整理上传完成,需要的朋友们可以自行领取【保证100%免费】

​​​软件测试面试文档

我们学习必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有字节大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。

在这里插入图片描述

在这里插入图片描述

  • 8
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值