Reputation: 443
There are many similar posts but I can't find my solution.
My code is:
<span ng-bind="selected.S_date" class="ng-binding">Different value all the time here.</span>
I want to get the value Different value all the time here
from the span.
I can do
document.getElementsByClassName('ng-binding')[55].textContent
Here the 55
is dynamic, value change.
Found Python + Selenium: get span value from "ng-bind" but I want to do with JavaScript.
Want to do similar is JavaScript?
Upvotes: 0
Views: 680
Reputation: 443
The solution suggested by Heretic Monkey on the comment.
document.querySelector("span[ng-bind='selected.S_date']")
Upvotes: 1