0

My code is below :

$I->see('20.4','//*[@class="container ng-scope"]/div/div/div/div/div[@class="bigNum ng-binding"]');

It is working fine but as you can see tthe class is nested into multiple div, want to get rid of so many divs nested.

I tried :

$I->see('20.4','//*[@class="container ng-scope"]//*div[@class="bigNum ng-binding"]');

Gives me error :

Cannot find the element.

Any solution?

Yi Zeng
  • 32,020
  • 13
  • 97
  • 125
shab
  • 989
  • 1
  • 15
  • 31

1 Answers1

2

Not sure if this is just a typo you made when pasting the code here or not.

Your XPath isn't valid.

//*[@class="container ng-scope"]//*div[@class="bigNum ng-binding"]

should be

//*[@class="container ng-scope"]//div[@class="bigNum ng-binding"]

Also in your case, CSS selector should be better. [@class="container ng-scope"] in XPath will match those two classes in exact order and whitespace, which is probably not what you want.

.container.ng-scope .bigNum.ng-binding
Yi Zeng
  • 32,020
  • 13
  • 97
  • 125
  • 1
    @shab: Since you're a new user and never accepted any answers before. Just so you know if this fixes your issue, please accept http://meta.stackexchange.com/a/5235/220697. Thanks. – Yi Zeng May 06 '14 at 22:02