I am testing an ECM system using Selenium WebDriver for Python and, for the last couple of weeks, all my tests that previously worked are now failing in Chrome and Edge browsers.
Essentially, I can log in, but once I get to any page in the system, Selenium fails to find any element on the page. In fact, it can see that there are elements in the DOM, but cannot access them.
I have the following code:
elements = driver.find_elements(By.XPATH, "//*")
print(len(elements))
for element in elements:
print(type(element))
Running this on the login page (before logging in) or on several other websites, I get something like this:
68
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
...
However, running it on the landing page of my system, I get this:
987
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>
...
And, finally, running it on the exact same page, but in Firefox instead, I get this:
15
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
<class 'selenium.webdriver.remote.webelement.WebElement'>
...
Which is the expected result when calling findElements(). What could possibly have happened in Chrome and Edge in the last few weeks that caused this?