I've tried to write a script in python in combination with selenium to wait for a certain element to be available. The content I wish my script waits for is captcha protected. I do not want to set a fixed time. So, I need it to wait until I can solve myself.
I've tried like:
import time
from selenium import webdriver
URL = "https://www.someurl.com/"
driver = webdriver.Chrome()
driver.get(URL)
while not driver.find_element_by_css_selector(".listing-content"):
time.sleep(1)
print(driver.current_url)
driver.quit()
But, the script throws an error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:
How can I make my script wait until the element is available no matter how long it takes?
driver.find_element_by_css_selector(".listing-content")throws the same error (cosider that the selector contains captcha element).