find_elements with get_atributes('innerhtml&quort;)
我有以下情况,
values = driver.find_elements(By.CLASS_NAME, "roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f")
到目前为止,我将获得260个钥匙的列表,还可以! 但是,我需要这个简化的列表,只有文本
values = driver.find_elements(By.CLASS_NAME, "roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f").get_attribute("innerHTML")
有可能获得上面的类似内容?使用 find_element 它可以正常工作。 find_element s 不起作用。
一个具有[x] .TEXT的循环太慢。 我用一个简单的数组对其进行了测试,而没有“ .TEXT”,并且更快的速度是1000倍。
I have the following situation
values = driver.find_elements(By.CLASS_NAME, "roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f")
I get list with 260 keys, So far, okay!
However, I need this simplified list, with just the text
values = driver.find_elements(By.CLASS_NAME, "roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f").get_attribute("innerHTML")
Is there any possibility to get something like this above? With find_element it works fine.
find_elementS not work.
A loop with values[x].text is too slow.
I tested it with a simple array, without the ".text" and it's 1000x faster.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
Try:
提取 innerhtml 或来自所有匹配元素的文本,您可以使用列表理解 您可以使用以下任何一个 定位器策略 :
使用 <>
代码> get_attribute(“ innerhtml”) :
使用 text :
To extract the innerHTML or the texts from all the matching elements you can use list comprehension and you can use either of the following locator strategies:
Using
get_attribute("innerHTML")
:Using text: