I need to find this image element using xpath. Selenium throws a NoSuchElementException yet when the webpage is still open, I can find the element by pasting the xpath into the developer tools find function.
I've tried implicit and explicit wait, normal sleep commands, continually searching for the element in a for loop (8 hours)
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get('https://captcha.com/demos/features/captcha-demo.aspx')
WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.XPATH,'//*[@id="c_captchademo_samplecaptcha_CaptchaImage"]')))
img = driver.find_element_by_xpath('//*[@id="c_captchademo_samplecaptcha_CaptchaImage"]')
print(img)