我如何使用Java中的CSS选择器选择等于“Pay From”的“th”类“form-control”(这是一个下拉列表)?
<table class="table">
<tbody>
<tr>
<th>Pay From</th>
<td>
<select class="form-control col-sm-2 ng-pristine ng-invalid ng-invalid-required ng-touched" ng-model="payment.selectedPaymentMethod" ng-options="paymentMethod as paymentMethod.text for paymentMethod in payment.paymentMethods track by paymentMethod.paymentMethodId" name="accountType" required="">
我知道你可以为'嵌套'对象做类似的事情:
(By.cssSelector("table[class='table'] > select[class^='form-control']"));
但我如何利用没有属性的“th”?
答案 0 :(得分:2)
(By.cssSelector(&#34; table [class =&#39; table&#39;]&gt; tr:nth-child(1)&gt; th:nth-child(1)&#34;) );