Let's say you're on Website A, and you click a button that takes you to Website B, which immediately redirects you to Website C. A regular Back action, self.go_back(), would take you to Website B, which might immediately redirect you back to Website C again, which is probably not what the user wanted. In this special case, self.go_back() should take you to Website A. (2 Back actions).
In summary: If self.go_back(), (which calls self.driver.back()), doesn't change the current URL, then call self.driver.back() one more time. That should solve the odd case I've encountered.
Handle using
go_back()
after a URL redirectLet's say you're on Website A, and you click a button that takes you to Website B, which immediately redirects you to Website C. A regular Back action,
self.go_back()
, would take you to Website B, which might immediately redirect you back to Website C again, which is probably not what the user wanted. In this special case,self.go_back()
should take you to Website A. (2 Back actions).In summary: If
self.go_back()
, (which callsself.driver.back()
), doesn't change the current URL, then callself.driver.back()
one more time. That should solve the odd case I've encountered.