Here is my code snippet:
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.history.go(-1);");
The code above isn't working. I've tried casting the webdriver instance but it doesn't work every time.
I prefer not to use driver.navigate().back()
as it is not recommended.
Any suggestions on how to resolve this?