gpt4 book ai didi

python - Selenium Python : 'ElementNotInteractableException'

转载 作者:行者123 更新时间:2023-12-01 06:38:18 29 4
gpt4 key购买 nike

我正在尝试send_keysinputid model-account-name-input从这里link 。这是我的代码:

driver.find_element_by_id('model-account-name-input').click() #Make it reachable by Keyboard
driver.find_element_by_id('model-account-name-input').send_keys('Test')

使用此代码,我收到以下错误:ElementNotInteractableException: Message: Element <input id="modal-account-name-input" class="menu-option player-name-input" type="text"> could not be scrolled into view

这是我想要的输入图像 send_keys到。 enter image description here

最佳答案

要在文本框中输入文本,请诱导 WebDriverWait 并等待 element_to_be_clickable()以及以下 ID。

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
driver.get("https://surviv.io/")
WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.ID,"player-name-input-solo"))).send_keys("Test")

浏览器快照

enter image description here

关于python - Selenium Python : 'ElementNotInteractableException' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59565352/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com