【问题标题】:Selenium IDE checkbox checked identificationSelenium IDE 复选框选中标识
【发布时间】:2016-07-06 08:24:20
【问题描述】:

我正在学习如何使用 Selenium IDE,我认为它进展顺利,但现在我似乎找不到如何检查该页面上的复选框。

https://www.otelo.de/warenkorb.html?id=-1

我似乎不知道如何查看复选框是否被选中

selenium ide 向我展示的唯一内容是 id=mnp 如果我尝试记录它

你能帮我告诉我我做错了什么吗?

非常感谢你!

【问题讨论】:

    标签: selenium checkbox ide checked


    【解决方案1】:

    我已经使用SelBlocks 插件 for If-Else 你可以使用storeChecked 来存储复选框的状态

    storeChecked(定位器,变量名)
    生成自 isChecked(locator)
    参数:

       locator - an element locator pointing to a checkbox or radio button
    

    返回:

          true if the checkbox is checked, false otherwise
    

    获取是否选中了切换按钮(复选框/单选)。如果指定元素不存在或不是切换按钮,则失败。

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
       <title>IfElse</title>
    </head>
    <body>
    <table cellpadding="1" cellspacing="1" border="1">
    <thead>
    <tr><td rowspan="1" colspan="3">IfElse</td></tr>
    </thead><tbody>
    <tr>
        <td>open</td>
        <td>https://www.otelo.de/warenkorb.html?id=-1</td>
        <td></td>
    </tr>
    <tr>
        <td>storeChecked</td>
        <td>id=mnp</td>
        <td>state</td>
    </tr>
    <tr>
        <td>if</td>
        <td>${state}==false</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>id=mnp</td>
        <td></td>
    </tr>
    <tr>
        <td>endIf</td>
        <td></td>
        <td></td>
    </tr>
    </tbody></table>
    </body>
    </html>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多