简体   繁体   English

Python Selenium 如果元素中没有文本或值属性,如何获取文本值

[英]Python Selenium How to get the text value if no text or value attribute in the element

I tried below ways to get the input field text value, but all of them were failed:我尝试了以下方法来获取输入字段的文本值,但都失败了:

.get_attribute('value')
.text
.get_attribute('textcontent')

Here is the element:这是元素:

<input placeholder="Name" type="text" formcontrolname="name" class="lmn-input ng-star-inserted ng-touched ng-dirty ng-valid">

Here is the input box:这是输入框: 在此处输入图像描述

There exists another method:还有另一种方法:

elem.get_text()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM