0
<div id="page" class="container-fluid">
<div id="pageContent" class="">
<h1>Angular Test: projectUI</h1>
<!-- ngView: -->
<div class="ng-scope" data-ng-view="">
<ul class="package-menu container white ng-scope">
<!-- ngRepeat: package in packages | orderBy:'name' -->
<div class="ng-scope" data-ng-repeat="package in packages | orderBy:'name'">
<li>
<a class="ng-binding" href="#package/2">Craig's farm</a>
</li>
</div>

task : I want to click on Craig's farm label but when i try to click via CSS it give below

error: CSS or XPath '#pageContent.package-menu.container.white.ng-scope>li:nth-child(1)

can anyone give me the exact xpath of the above code??

Thank you

shab
  • 989
  • 1
  • 15
  • 31

1 Answers1

1

I believe the issue is that your html snippet is not valid xml. There are a lot of unclosed tags and no root element. Xpath works on xml and xml is stricter than html.

//a[@class="ng-binding" and text()="Craig's farm"]

Fix the html and run the above xpath

TGH
  • 38,769
  • 12
  • 102
  • 135
  • "//a[@class='ng-binding']/div[text()='Craig's farm'] trying this failed saying was not found on page. – shab Apr 04 '14 at 02:49