I need to have a unique locator since i cannot use text because it both have facility, I need to click this
here is my sample code right now but it does not click
findLink(By.xpath("//*[ng-click()='promptGroupDrawerCtrl.closeDrawer()']")).click
I need to have a unique locator since i cannot use text because it both have facility, I need to click this
here is my sample code right now but it does not click
findLink(By.xpath("//*[ng-click()='promptGroupDrawerCtrl.closeDrawer()']")).click
There are two problems with the xpath
:
ng-click
is an attribute, not a method. Remove the round brackets.
Attribute name should start with @
findLink(By.xpath("//*[@ng-click='promptGroupDrawerCtrl.closeDrawer()']")).click();
To click on the element with text as Facility you can use the following solution:
findLink(By.xpath("//a[@class='h4 panel-heading panel-back panel-title btn ng-binding' and contains(@ng-click,'closeDrawer')]")).click
Note: As the element is an Angular element you have to induce WebDriverWait for the desired element to be clickable