【问题标题】:Selenide - found and fill the elementSelenide - 找到并填充元素
【发布时间】:2017-03-05 17:25:09
【问题描述】:

我未能通过 selenide 分配以下元素(我需要找到并用文本(ID)填充它:

                 <tr>
                    <th class="col-md-3 basicPropertiesName">Id</th>
                    <td class="col-md-9">
                        <input class="form-control ng-pristine ng-valid ng-                   touched" ng-keypress="keypressHandler($event, 2)" ng-model="newInsight.id" placeholder="ID">
                    </td>
                </tr>

【问题讨论】:

    标签: selenide


    【解决方案1】:

    或者这个?

    $("input[ng-model='newInsight.id']").setValue(value);
    

    【讨论】:

      【解决方案2】:

      也许你需要这样的东西?

      By(xpath("//input[@ng-model='newInsight.id']))
      

      【讨论】:

        【解决方案3】:
        $(By.xPath("//tr[./th[text()='Id']]")).find("input").setValue("some text)
        

        或者没有额外的 find()

        $(By.xPath("//tr[./th[text()='Id']]//input")).setValue("some text)
        

        【讨论】:

          【解决方案4】:

          您也可以使用 css 选择器使用以下选项。

          String str="th[class*='basicPropertiesName']";
          SelenideElement element =$(str);
          

          String str="th:contains('Id')";
          SelenideElement element =$(str);
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2018-09-21
            • 2016-08-09
            • 2021-10-07
            • 2020-02-03
            • 2014-05-25
            • 1970-01-01
            • 2021-05-05
            • 1970-01-01
            相关资源
            最近更新 更多