简体   繁体   English

selenium.common.exceptions.ElementNotInteractableException:消息:使用Selenium和Python插入值时元素不可交互

[英]selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable while inserting value using Selenium and Python

I'm trying to insert a value into a text box located in a web page. 我正在尝试将值插入位于网页中的文本框中。

Text box appears at the bottom of the web page and the element is not locatable by the code. 文本框出现在网页的底部,并且该代码找不到该元素。 I should Inspect two times to see the table value in Chrome (first time it shows a different/parent HTML all together) that suggests us that there are multiple layers and requires finding in deep. 我应该进行两次检查 ,以查看Chrome中的表格值(首次显示所有HTML /父HTML),这表明我们存在多个层次,需要深入研究。

I've tried inserting the string as shown below.. 我尝试插入如下所示的字符串。

driver.find_element_by_id("arid1005").send_keys("TESTING")

and

elem = driver.find_element_by_id("arid1005")
driver.execute_script('arguments[0].value = "TESTING";',elem)

I've also tried finding the elements by Class Name, CSS, Xpath but end up getting 我也尝试过通过类名,CSS,Xpath查找元素但最终得到

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

When I inspect 2 times, the below table gets highlighted. 当我检查2次时,下表将突出显示。

<table class="SearchBarInput" width="100%">
<tbody>
<tr><td width="">
<textarea style="width:99%;height:21px;" class="sr" cols="" wrap="off" rows="1" id="arid1005"></textarea></td>
</tr>
</tbody>
</table>

Can somebody throw some light on what I'm missing here? 有人可以告诉我我在这里想念的东西吗? Sorry if this question was already asked but I couldn't find any relevant so far. 抱歉,是否已经有人问过这个问题,但到目前为止我找不到任何相关问题。

The id attribute of the desired element looks dynamic, so to click() on the element you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following solutions: 所需元素的id属性看起来很动态,因此要对元素进行click()就必须为element_to_be_clickable()诱导WebDriverWait ,并且可以使用以下任一解决方案:

暂无
暂无

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

相关问题 selenium.common.exceptions.WebDriverException:消息:未知错误:通过Selenium Python使用execute_script()时,“脚本”必须是字符串 - selenium.common.exceptions.WebDriverException: Message: unknown error: 'script' must be a string while using execute_script() through Selenium Python ElementNotInteractableException:使用 Selenium 和 Python 在 td 元素内设置值时出错 - ElementNotInteractableException:Error when setting a value within td element using Selenium and Python 硒元素不可相互作用 - selenium element not interactable Selenium ElementNotInteractableError:元素不可交互 - Selenium ElementNotInteractableError: element not interactable selenium.common.exceptions.WebDriverException:消息:未知错误:arguments [0] .click不是在Selenium Python中使用execute_script()的函数 - selenium.common.exceptions.WebDriverException: Message: unknown error: arguments[0].click is not a function using execute_script() in Selenium Python 带有硒的 Powershell:错误:元素不可交互 - Powershell with Selenium: Error: element not interactable selenium.common.exceptions.InvalidSelectorException: Message: Given xpath expression is invalid using xpath within scrollIntoView through Selenium - selenium.common.exceptions.InvalidSelectorException: Message: Given xpath expression is invalid using xpath within scrollIntoView through Selenium 如何使用 Javascript 等到元素在 Selenium 中可交互 - How to wait until element is interactable in Selenium using Javascript selenium.common.exceptions.WebDriverException:消息:TypeError:p [0]未定义 - selenium.common.exceptions.WebDriverException: Message: TypeError: p[0] is undefined selenium.common.exceptions.JavascriptException:消息:javascript 错误:意外的标识符 - selenium.common.exceptions.JavascriptException: Message: javascript error: Unexpected identifier
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM