如何使用Selenium Web驱动程序获取文本区域内容 [英] How to get text area content using selenium web driver

查看:75
本文介绍了如何使用Selenium Web驱动程序获取文本区域内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下内容(文本区域).此文本区域的值不会出现在html代码中.但这将在页面加载后显示在网页中.如何使用Selenium和python获取值.

I have the following element(text area). The value of this text area won't appear in the html code. But that will be displayed in webpage when page is loaded. How to get the value using selenium and python.

<textarea id="query" class="textarea" cols="37" rows="30"></textarea>

推荐答案

textarea的内容将显示在其value属性中,就像input元素一样.就像(pseudo-Python)

The contents of the textarea will be shown in it's value property, just like input elements. So something like (pseudo-Python)

 contents = driver.find_element_by_id('query').get_attribute('value')

这篇关于如何使用Selenium Web驱动程序获取文本区域内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆