I am very new to Selenium.
I am trying to find button Validate (see below) and not to use xpath.
<div class="order">
<a style="float: left;" href="#143207" class="VoidDoc ui-button ui-corner-all ui-widget" role="button"> Void </a>
<a style="float: left;" href="validatedocumentation.php?documentId=143207&origin=viewreferral.php&OrderId=836829" class="ui-button ui-corner-all ui-widget" role="button"> Validate </a>
<a class="signDocBehalf ui-button ui-corner-all ui-widget" style="float: left;" href="#143207#20263#836829" role="button">Sign</a>
<a style="float: left;" href="editdocumentation.php?documentId=143207&origin=viewreferral.php" class="ui-button ui-corner-all ui-widget" role="button"> Edit </a>
</div>
I tried to look by a class name (unfortunately not unique) and text of the button ("Validate"):
.....Driver.findElement(By.xpath("//a[@class='ui-button ui-corner-all ui-widget' and text()='Validate']")).click();
also I tried
.....Driver.findElement(By.xpath("//div[@class='ui-button ui-corner-all ui-widget' and text()='Validate']")).click();
getting an error:
no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='ui-button ui-corner-all ui-widget' and text()='Validate']"}
(Session info: chrome=94.0.4606.81)
I am guessing it is because "<a>" is nested in "<div>" , correct me if I am wrong.
How it would be right to identify this button.
Please, give me your kind advice.