ElementNotInteractableException: Сообщение: элемент не взаимодействует с ошибкой отправки текста в поле поиска с использPython

Программы на Python
Anonymous
ElementNotInteractableException: Сообщение: элемент не взаимодействует с ошибкой отправки текста в поле поиска с использ

Сообщение Anonymous »

Я пытаюсь использовать send_keys на веб-сайте, но выдает ошибку: элемент несовместим.
Вот мой код ниже:

Код: Выделить всё

import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
import time

chrome_optionsme = Options()
chrome_optionsme.add_argument("--incognito")
chrome_optionsme.add_argument("--window-size=1920x1080")
driver = webdriver.Chrome(options=chrome_optionsme,
executable_path="/Users/chueckingmok/Desktop/html/chromedriver")

url='https://thelubricantoracle.castrol.com/industrial/en-DE'
driver.get(url)
time.sleep(5)

welcome_sec_one=WebDriverWait(driver,10).until(
EC.presence_of_element_located((By.XPATH,'//*[@id="ctl00_termsPopup_lbConfirm"]'))
)
welcome_sec_one.click()

time.sleep(5)

driver.find_element_by_xpath("//input[@class='search'[@id='txtSearch']").send_keys("Example")
Изображение

Код: Выделить всё

Here is the code

ElementNotInteractableException           Traceback (most recent call last)
 in 
----> 1 driver.find_element_by_xpath("//input[@class='search'][@id='txtSearch']").send_keys("Example")

/Applications/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py in send_keys(self, *value)
477         self._execute(Command.SEND_KEYS_TO_ELEMENT,
478                       {'text': "".join(keys_to_typing(value)),
--> 479                        'value': keys_to_typing(value)})
480
481     # RenderedWebElement Items

/Applications/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py in _execute(self, command, params)
631             params = {}
632         params['id'] = self._id
--> 633         return self._parent.execute(command, params)
634
635     def find_element(self, by=By.ID, value=None):

/Applications/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
319         response = self.command_executor.execute(driver_command, params)
320         if response:
--> 321             self.error_handler.check_response(response)
322             response['value'] = self._unwrap_value(
323                 response.get('value', None))

/Applications/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
240                 alert_text = value['alert'].get('text')
241             raise exception_class(message, screen, stacktrace, alert_text)
--> 242         raise exception_class(message, screen, stacktrace)
243
244     def _value_or_default(self, obj, key, default):

ElementNotInteractableException: Message: element not interactable
(Session info: chrome=83.0.4103.116)
Я думаю, проблема в том, что я не могу в конечном итоге найти элемент.
Именно поэтому элемент не доступен для взаимодействия.
Кстати, ссылка на веб-сайт: https:/ /thelubricantoracle.castrol.com/industrial/en-DE#
Я хочу использовать кнопку поиска.
Кто-нибудь может помочь?

Подробнее здесь: https://stackoverflow.com/questions/628 ... or-sending

Вернуться в «Python»