Selenide - 找到并填充元素

时间:2017-03-05 17:25:09

标签: selenide

我未能通过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>

4 个答案:

答案 0 :(得分:0)

也许你需要这样的东西?

shared_ptr

答案 1 :(得分:0)

或许这个?

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

答案 2 :(得分:0)

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

或没有额外的find()

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

答案 3 :(得分:0)

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

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

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