I have this div with label "First Name", which I want to find in my Selenium e2e test:
<div class="control-group ng-class: { 'error': isInErrorState() } ng-scope" dto-control-group="" label="First Name">
<label class="control-label" for="FirstName">
<span class="ng-binding">First Name</span>
<span class="required-asterisk" ng-show="isRequired">*</span>
</label>
<div class="controls">
<input type="text" id="FirstName" dto-input-validate="" name="FirstName" ng-model="qform.submission.persons[0].firstName" class="ng-scope ng-pristine ng-invalid ng-invalid-dtorule">
<div class="inline-messages">
<!-- ngIf: helpMsg -->
<span class="error-inline ng-binding">This is a required field</span>
</div>
</div>
</div>
here's my Java code:
// XXX this returns NULL
@FindBy(xpath = "//div[@label=\"First Name\"]")
private InputElement firstName;
what's wrong here?
I think this will work for you:
@FindBy(xpath = "//div[@label='First Name']")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With