我有一个网站,我需要填写一个输入字段。 只有37.75的字段引起了问题,它没有被禁用。它有一个占位符,我自己可以轻松地与它交互,但当涉及到selenium时,我不能
我试过:
self.driver.execute_script(f"document.getElementById('product_length').value='{str(depth10)}'")
这没用
pyperclip.copy(str(depth10))
self.driver.find_element_by_id("product_length").click()
pclip.paste()
self.driver.find_element_by_id("product_length").send_keys(str(depth10))
每个find\u元素\u by\u id()都返回异常:
selenium.common.exceptions.ElementNotInteractableException: Message: Element <input id="product_length" class="input-text wc_input_decimal" name="_length" type="text"> could not be scrolled into view
我使用了预期条件&;WebdriverWait与element_to_be_clickable()
一起,但在2分钟内找不到它
我还尝试:
actions.move_to_element(element).perform()
及
driver.execute_script("arguments[0].scrollIntoView();", element)
此错误消息
…意味着在调用
click()
时WebElement不可交互解决方案
理想情况下,要单击元素,您需要为
element_to_be_clickable()
诱导WebDriverWait,并且可以使用以下Locator Strategies之一:使用
CSS_SELECTOR
:使用
XPATH
:注意:您必须添加以下导入:
相关问题 更多 >
编程相关推荐