So im running this piece of code, basically you enter a code and press a button and then the page redirects if the code is correct.
So i want the code to detect if an image on that page disappears using "invisibility_of_element_located" (So that i can tell if the page has loaded) which works fine when used alone, however i want to use it in an if statement, such that if the element does go invisible:
print(something)
However i cant seem to figure out how to set it up in such a way. I've tried making it == True but still got nothing. I've also tried using it in try except loops but essentially i dont know what it returns so i cant use it properly.
if WebDriverWait(driver, 50).until(EC.invisibility_of_element_located((By.CLASS_NAME, "NXVPg Szr5J coreSpriteLock "))) == True:
print("Now its loaded")
else:
print("Nope not loaded")
When using it as above, with or without the == True it straight away prints the response of ("Now its loaded") Even if the page hasnt actually changed. However when used like this:
WebDriverWait(driver, 50).until(EC.invisibility_of_element_located((By.CLASS_NAME, "NXVPg Szr5J coreSpriteLock ")))
print("Now its loaded")
It does actually wait and works properly, only problem is i cant use an else to show it hasnt loaded, any help would be greatly appreciated!