【发布时间】:2018-07-26 07:03:08
【问题描述】:
<textarea style="position: absolute; padding: 0px; width: 1px; height: 1em; outline: currentcolor none medium;" autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" wrap="off"></textarea>
这是我尝试使用 XPath 访问它的方式:
driver.find_element_by_xpath("/html/body/div/div[1]/textarea").send_keys("Some text here")
在页面上找不到元素的错误:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: /html/body/div/div[1]/textarea
我也使用 css_selector 来访问元素,但仍然是同样的错误。 如何正确访问弹出窗口?
这里有更多的 HTML 代码:https://pastebin.com/6jdix2Cm
【问题讨论】:
-
好像在 iframe 中。你能分享更多关于这个
textarea的HTML吗 -
这里有更多代码pastebin.com/6jdix2Cm。 Textarea 包裹在 iframe 中
-
@Andrew:你能给我们更新吗?任何一个答案有帮助吗?还是您仍然面临任何问题?
-
@cruisepandey 非常感谢它解决了我的问题!
标签: python selenium selenium-webdriver xpath webdriverwait