I am fairly new to Python and Selenium, but I have been able to navigate through many webpages via Selenium just fine. But a site recently changed their html code and now Selenium is not able to find any element on the page. Specifically I would like to click the Export-button, which is a span inside an a inside many divs.
This is the page: https://www.st.com/en/diodes-and-rectifiers/power-schottky/products.html#
I am using the Selenium Chromedriver on Windows 10 with Python.
I have tried every selector I know (Rel XPATH, Abs XPATH, CSS-Selector, name, ID, link text, ...) but I always get selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:.
The website does use iframes, but as I see it, the Export-button is not inside an iframe. Also, while trying to test, I was not able to find the iframes with Selenium. Really any element besides the body can not be found anymore. I am making to make sure the element is loaded, but the error message appears even while waiting for the element, because Selenium can't find it.
Here is an example using the relative XPath, but I have not had any success with Css-Selector or anything else, or any other element:
# setup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC
# setup
options = webdriver.ChromeOptions ( ) ;
prefs = { "download.default_directory" : mypath };
options.add_experimental_option ( "prefs", prefs );
options.add_experimental_option ( "excludeSwitches", ["enable-logging"] )
options.add_argument ( '--headless' )
driver = webdriver.Chrome ( executable_path = 'chromedriver.exe', options = options );
driver.get ( https://www.st.com/en/diodes-and-rectifiers/power-schottky/products.html# ) 
# wait
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='st-site']/div[3]/div[1]/main/div[2]/div[5]/div[3]/div/div[3]/div[1]/div[3]/div/a/span")))
# download
driver.execute_script('arguments[0].click()', driver.find_element(By.XPATH, "//*[@id='st-site']/div[3]/div[1]/main/div[2]/div[5]/div[3]/div/div[3]/div[1]/div[3]/div/a/span"))
Which gives me the timeout error:
Traceback (most recent call last):
    line 228, in the_magic
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='st-site']/div[3]/div[1]/main/div[2]/div[5]/div[3]/div/div[3]/div[1]/div[3]/div/a/span")))
    line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
If I make sure to wait for the webpage to be loaded with time.sleep(30) and skipping the WebDriverWait, the error message is:
Traceback (most recent call last):
    line 231, in the_magic
    driver.execute_script('arguments[0].click()', driver.find_element(By.XPATH, "//*[@id='st-site']/div[3]/div[1]/main/div[2]/div[5]/div[3]/div/div[3]/div[1]/div[3]/div/a/span"))
    line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
    line 321, in execute
    self.error_handler.check_response(response)
    line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='st-site']/div[3]/div[1]/main/div[2]/div[5]/div[3]/div/div[3]/div[1]/div[3]/div/a/span"}
  (Session info: headless chrome=110.0.5481.178)
I don't really know what to try anymore. Any help would be appreciated.
 
     
    
