1

How would I select the class "form-control" (which is a dropdown) for the "th" that equals "Pay From" using the CSS selector in Java?

<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="">

I know you can do something similar to the following for 'nested' objects:

(By.cssSelector("table[class='table'] > select[class^='form-control']"));

but how do I utilize the "th" that doesn't have an attribute?

1 Answer 1

2

(By.cssSelector("table[class='table'] > tr:nth-child(1) > th:nth-child(1)"));

Sign up to request clarification or add additional context in comments.

1 Comment

In your browser (e.g. firefox, chrome, IE) right click on the element and choose Inspect Element. Right click again on the html element and choose Copy Unique Selector.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.