【问题标题】:How to select an element from a drop down unordered list in Selenium IDE如何从 Selenium IDE 中的下拉无序列表中选择元素
【发布时间】:2018-03-22 04:35:26
【问题描述】:

我无法从此下拉菜单中选择链接。 html是这样的:

<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22594"><a href="http://toolsqa.com/automation-practice-form/" data-level="2"><span class="menu-item-text"><span class="menu-text">Automation Practice Form</span></span></a></li>

我试过了

命令:选择 目标:class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22594"

但它失败了。我想导航到该链接以测试该网页上的其他内容。

【问题讨论】:

    标签: html selenium testing selenium-ide


    【解决方案1】:

    在 Select 类的情况下,使用通常的方式来识别元素。您可以使用 xpath : //span[text()='Automation Practice Form'] 来识别元素,然后单击它。它应该工作。

    注意:当它存在于 DOM 中时,我们应该使用 Select 类

    【讨论】:

      【解决方案2】:

      要点击带有自动化实践表格文本的链接,您可以使用以下xpath

      //a[@href='http://toolsqa.com/automation-practice-form/']/span[@class='menu-item-text']/span[@class='menu-text']
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-13
        • 1970-01-01
        • 2020-12-01
        相关资源
        最近更新 更多