seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.67k stars 929 forks source link

Handle using go_back() after a URL redirect #1712

Closed mdmintz closed 1 year ago

mdmintz commented 1 year ago

Handle using go_back() after a URL redirect

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.

mdmintz commented 1 year ago

Released in 4.12.3 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.12.3