python selenium go back to previous page
driver.execute_script("window.history.go(-1)")
Here is what the above code is Doing:
1. It’s going to the Google home page.
2. It’s searching for the term “Python”.
3. It’s clicking on the first result.
4. It’s going back to the Google home page.