Я использую явное ожидание, как показано ниже, чтобы проверить, является ли элемент кликабельным.
WebDriverWait(driver, 30).until(
expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, "#search")))
Но я получаю ошибку
<class 'selenium.common.exceptions.WebDriverException'>
Message: The command 'GET /session/.../displayed' was not found.
Если я использую time.sleep()
он отлично работает, а не explicir, подождите, пока он работает нормально. Я инициализировал драйвер сафари как
from selenium.webdriver import Safari
driver = Safari()
Вот stacktrace
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/support/wait.py", line 71, in until
value = method(self._driver)
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/support/expected_conditions.py", line 283, in __call__
element = visibility_of_element_located(self.locator)(driver)
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/support/expected_conditions.py", line 127, in __call__
return _element_if_visible(_find_element(driver, self.locator))
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/support/expected_conditions.py", line 147, in _element_if_visible
return element if element.is_displayed() == visibility else False
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 490, in is_displayed
return self._execute(Command.IS_ELEMENT_DISPLAYED)['value']
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute
self.error_handler.check_response(response)
File "/Users/Library/Python/2.7/lib/python/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: The command 'GET /session/7.../displayed' was not found.