我想将文本发送到页面的文本框。
这是页面上的隐藏元素:
<textarea class="chatterTopicsEnabled groupAtMentionsEnabled publishertextarea"
id="publishereditablearea"
name="publishereditablearea"
role="textbox" tabindex="0"
title="Topics" type="text" wrap="soft"
data-uidsfdc="112" style="height: 208px;">Topics</textarea>
<input type="hidden" id="publisherprompttext" name="publisherprompttext" value="Topics">
我的代码可以单击文本框,但无法发送文本:
textbox = [tag for tag in driver.find_elements_by_tag_name('textarea')
if tag.get_attribute('name') == 'publishereditablearea']
textbox[0].click()
textbox[0].send_keys("text")
错误消息说:element not visible.
如何将文本发送到文本框?
像这样使用execute_script
因为你的元素被隐藏了
element=driver.find_element_by_id("publishereditablearea")
driver.execute_script("arguments[0].click();", element)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)