我是靠谱客的博主 壮观花生,这篇文章主要介绍pythonselenium获取html标签内容_Python以及如何从Selenium元素WebElement对象获取文本?...,现在分享给大家,希望可以做个参考。

I am trying to get the tag text content in html page by using Selenium methods, but it seems method someElement.getText() is not available in Python.

Any help, please?

Here's traceback:

AttributeError: 'WebElement' object has no attribute 'getText'

解决方案

Once you locate the element you can use the text method.

Example:

for element in self.driver.find_elements_by_tag_name('img'):

print element.text

print element.tag_name

print element.parent

print element.location

print element.size

最后

以上就是壮观花生最近收集整理的关于pythonselenium获取html标签内容_Python以及如何从Selenium元素WebElement对象获取文本?...的全部内容,更多相关pythonselenium获取html标签内容_Python以及如何从Selenium元素WebElement对象获取文本?内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(103)

评论列表共有 0 条评论

立即
投稿
返回
顶部