I created a program in python selenium which does an action when you go on a specific url on selenium (with chrome driver). The problem is that only the first tab detects the url and if any other tab is used to visit the url it will not be detected.
my code to detect the url:
driver = webdriver.Chrome()
driver.get('https://www.google.com')
paypal_url = "paypal.com"
google_url = "google.com"
while True:
url = driver.current_url
if paypal_url in url and "signin" in url:
print("Connected on paypal !")
sleep(1)
do_action()
break
elif google_url in url and "signin" in url:
print("Connected on google !")
sleep(1)
do_action()
break
else:
sleep(1)
My question is:
How can I detect when the user goes on a specific url in any tabs (not only the first one)