I am automating a website for my study project but when I am performing a get function on the url it's not redirecting me to the desired url instead the page keeps on loading and after sometime it throws error.
The url I want to access is first it will call a url say example.com after entering some cred like id and password and hitting submit, Browser will redirect to an another url(such as example.com/dfuefh343643746ghbfb@/details/xyz) where I can full details about that person.
But in my case it's filling details and submitting the page correctly but the page keeps on loading it won't redirect to the details page and after sometime throws an error.
Here is my code
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
def main():
s = Service('D:/Chrome_WebDriver/chromedriver.exe')
driver = webdriver.Chrome(service=s)
driver.maximize_window()
wait = WebDriverWait(driver, 10)
driver.get("https://example.com")
time.sleep(5)
input_f1 = driver.find_element(By.NAME, "RetrieveDetails.RecordLocator").send_keys("QMUEJP")
input_f2 = driver.find_element(By.NAME, "polymorphicField").send_keys("xyzz2@gamil.com")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//button[normalize- space()="Submit"]'))).click()
wait.until(EC.url_changes("https://example.com"))
if __name__=='__main__':
main()
Here is error I am getting after running the code.
DevTools listening on ws://127.0.0.1:54778/devtools/browser/750e264e-9107-4a6a-9e2e-aa6dd456fae0
[18308:8628:0818/212846.227:ERROR:device_event_log_impl.cc(222)] [21:28:46.227] USB: usb_service_win.cc:415 Could not read device interface GUIDs: The system cannot find the file specified. (0x2)
Traceback (most recent call last):
File "d:\Python-Code\Script-Selenium\script2.py", line 26, in <module>
main()
File "d:\Python-Code\Script-Selenium\script2.py", line 21, in main
wait.until(EC.url_changes("https://example.com"))
File "d:\Python-Code\Python API Code\Python_api\API\lib\site-packages\selenium\webdriver\support\wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Actually the above code works fine when I added a line of code which is
wait.until(EC.url_changes("https://example.com"))
then I closed it and try to rerun it but after that it never ran and throws above error. Chrome : Version 116.0.5845.97 (Official Build) (64-bit) ChromeDriver : Version: 116.0.5845.96 (r1160321)[Stable] (Chrome Driver download link: https://googlechromelabs.github.io/chrome-for-testing/#stable)
I don't know if the error has to do anything with browser version and chromedriver version as I can see both are matched version.
I have also tried the same code EdgeDriver but showing the same error. I will be greatful if someone helps me identify what is the issue here, Thanks in advance!!!