Error Message: "Element Not Visible" when Script Reaches Last Element
Despite all attributes being in the same form, an error occurs when the script reaches the last element and displays "element not visible." All elements are enclosed in div tags on the same level, with the script able to populate data in all fields except for the Submit Button. The click event triggers an error message stating that the element is not visible. Interestingly, the script works in a popup window. A screenshot image of the popup has been included below.
HTML code snippet:
<form id="sighUpForm" class="form-signin ng-pristine ng-invalid ng-invalid-required ng-valid-pattern" novalidate="" name="sighUpForm">
<div class="row">
<div class="form-group">
<div class="form-group">
<div class="row">
<div class="form-group">
<label class="ng-bind-htmling" ng-bind-html="translation.signup_mobile">Mobile No.</label>
<div class="input-group">
<span class="error-msg ng-hide" style="color:red" ng-show="sighUpForm.PhoneNo.$invalid && submitted">
</div>
<div style="text-align:center;">
<label class="checkbox-inline ng-bind-htmling" style="line-height:1.8; font-size:12px">
<input class="ng-pristine ng-untouched ng-empty ng-invalid ng-invalid-required" type="checkbox" value="" ng-model="user.termAndCondition" required="" name="termAndcondition" style="height:15px; width:15px; margin-top:5px; margin-right:3px "/>
I agree to the
<a data-target="#tandcmodal" data-toggle="modal" href="#">
and
<a data-target="#ppmodal" data-toggle="modal" href="#">
</label>
<br/>
</div>
<div class="text-center">
<!-- <small class="tc-text">By signing up, you agree to our <a href="#" data-toggle="modal" data-target="#tandcmodal">Terms & Condions</a> and <a href="#" data-toggle="modal" data-target="#ppmodal">Privacy Policy</a></small><br />-->
<!--<button id="submitSignup" type="submit" ng-click="SignUpUser()" class="button signup-btn">Signup</button>-->
<a id="submitSignup" class="button signup-btn" ng-click="SignUpUser()">
</div>
</form>
Selenium Code Segment:
//Enter PhoneNumber
driver.findElement(By.xpath(prop.getProperty("SignUpPhoneNo"))).sendKeys(prop.getProperty("PhoneNumber"));
Thread.sleep(500);
//Click Agree Tick
driver.findElement(By.xpath(".//*[@id='sighUpForm']/div[6]/label/input")).click();
Thread.sleep(600);
//Click Submit button
driver.findElement(By.xpath(".//*[@id='submitSignup']/span")).click();
Popup Screenshot Link: