I am having problems trying to identify the element using selenium and java...for the following link:
<a id="newSearchNavigateHeadingEventId_0" class="search-heading" ng-href="book/event?eid=757231&" target="_self" href="book/event?eid=757231&">
<h2 ng-bind="event.EventDisplayName" class="ng-binding">Makerspace Docklands - Safety Induction</h2>
</a>
I have tried the following ...
WebElement we = myDriver. findElement(By.linkText("Makerspace Docklands - Safety Induction"));
WebElement we = myDriver.findElement(By.id("newSearchNavigateHeadingEventId_0"));
WebElement we = myDriver.findElement(By.xpath( " //a[@id='newSearchNavigateHeadingEventId_01'] "));
WebElement we = myDriver.findElement(By.xpath("//a[text()='Makerspace Docklands - Safety Induction']"));
WebElement we = myDriver.findElement(By.xpath("//a[@href='book/event?eid=757231&']")) ;
But I keep getting the following message...
org.openqa.selenium.NoSuchElementException: Unable to locate element: ....
Could some-one suggest what would be the correct path so that I can click on the link with:
we.click();