Reputation: 1
The element I have located here in Chrome dev tools looks like this.
<a href="gumby/ui/gumbies/579" title="Mr McGoo meet, Gumby" class="ng-binding">PlayDoh met Mr Potato Head</a>
how to I get the string "gumby/ui/gumbies/579"
out of it using protractor?
tried everything using getText()
, getAttribute('href')
doesn't seem to work for me.
thanks!
Upvotes: 0
Views: 8395
Reputation: 152
There's another way to get text of an anchor tag and then clicking it
element(by.partialLinkText('PlayDoh met Mr Potato Head')).click();
Upvotes: 0
Reputation: 3172
getAttribute('href') is correct, but did you tried using it on the correct element, like this:
element(by.cssContainingText("a","PlayDoh metMrPotatoHead")).getAttribute('href')
Upvotes: 8