For scrapy/selenium is there a way to go back to a previous page? For scrapy/selenium is there a way to go back to a previous page? selenium selenium

For scrapy/selenium is there a way to go back to a previous page?


The currently selected answer provides a link to an external site and that link is broken. The selenium docs talk about

driver.forward()driver.back()

but those will sometimes fail, even if you explicitly use some wait functions.

I found a better solution. You can use the below command to navigate backwards.

driver.execute_script("window.history.go(-1)")

hope this helps someone else in the future.


To move backwards and forwards in your browser’s history use

driver.forward()driver.back()