0

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?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Shimul D
  • 403
  • 4
  • 9

1 Answers1

1

The solution suggested by Heretic Monkey on the comment.

document.querySelector("span[ng-bind='selected.S_date']")
Shimul D
  • 403
  • 4
  • 9