Ways to detect Page Change:
CustomTracking
Using Console
localStorage.a=0;
TamperMonkey
//for the whole domain
localStorage.a++;
Python: [selq]
- Use an explicit wait with an expected condition
- While(self.driver.getCurrentUrl() != nextPageUrl) :sleep(2) #if url change
- By checking Title tag if it changes
CustomTracking
Using Console
localStorage.a=0;
TamperMonkey
//for the whole domain
localStorage.a++;
Python: [selq]
#For explicit wait
WebDriverWait(b, 5).until(
EC.presence_of_element_located((By.CSS_SELECTOR,'#s')))
WebDriverWait(b, 5).until(
EC.invisibility_of_element_located((By.CSS_SELECTOR,'#s')))
from selq import this
window_changed=bes('return +localStorage.a')
def iswc():
global window_changed
a=bes('return +localStorage.a')
for i in range(10):
if window_changed return True
sleep(2)
alert('Hey Baby')
exit()