有很多类似的帖子,但我找不到解决方案。
我的代码是:
<span ng-bind="selected.S_date" class="ng-binding">Different value all the time here.</span>
我想从跨度中获取此处始终不同的值
。
我能做到
document.getElementsByClassName('ng-binding')[55].textContent
这里的55
是动态的,值变化。
找到Python + Selenium: get span value from "ng-bind"但我想用 JavaScript 来做。
想要用 JavaScript 做类似的事情吗?
最佳答案
Heretic Monkey 在评论中建议的解决方案。
document.querySelector("span[ng-bind='selected.S_date']")
关于JavaScript从 “ng-bind”获取span值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60957953/