亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么 send_keys() 方法不起作用。`元素不可交互`

為什么 send_keys() 方法不起作用。`元素不可交互`

炎炎設計 2022-10-06 16:23:35
inpt1 =ui.WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH,"//div[@class='DraftEditor-editorContainer']")))print(len(inpt1))inpt1.send_keys('hello')使用上面的代碼,我得到了of 的1輸出,但是對于 send_keys 我得到了以下錯誤:lengthinpt1selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable我想將密鑰發送到黃線包圍的那個部分。
查看完整描述

1 回答

?
呼如林

TA貢獻1798條經驗 獲得超3個贊

嘗試下面的帶有動作鏈的代碼,當元素出現在 HTML DOM 上時拋出 ElementNotInteractableException,但它不是處于可以交互的狀態。:


    inpt1 =ui.WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH,"//div[@class='DraftEditor-editorContainer']")))

    print(len(inpt1))

    ActionChains(driver).move_to_element(inpt1).send_keys('hello').perform()

注意:請在您的解決方案中添加以下導入


from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.common.action_chains import ActionChains


查看完整回答
反對 回復 2022-10-06
  • 1 回答
  • 0 關注
  • 87 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號