python - 使用 Selenium Python 时如何从 td 标签获取文本值?
问题描述
html 看起来像:
<tbody>
<td>
content
</td>
</tbody>
我已经通过 find_element_by_xpath 函数找到了元素 td。但是我什至只得到没有内容的字符串,但实际上网络显示了内容。
代码喜欢:
driver.find_element_by_xpath('//tbody/td').text
解决方案
您可以使用:
.get_attribute('innerText')
推荐阅读
- php - FPDF 无法创建图像
- python - 使用 scikit-learn 加载 .arff 文件时出错
- xcode - 找不到 -lRNFirebase React Native 的库
- angular - Angular HttpClient 删除
- notepad++ - 我想删除 Notepad++ 中所有出现的类似文本
- vue.js - 带有来自 API 调用的值的 Vue.js 进度条
- dialogflow-es - 如何在 DialogFlow 中保持麦克风打开
- javascript - 使用 jquery 过滤 D3.js 地图?
- sql - SQL:根据属性顺序对行进行排序
- css - 在 :hover 上更改 background-position-x