Question

Inside a Geb test, I'd like to navigate back in the browser's history (ie. to click the browser's back button). I haven't found a way to do it using Geb API.

What I do is:

driver.navigate().back()               // usage of WebDriver API
browser.page(<<previous Page class>>)  // this tells Geb that the page has changed

The code works, but I don't like the usage of WebDriver API here. Another idea would be to do it in JavaScript, but that's also something I'd like to avoid.

Is there a more Gebish way of navigating back in the browser's history?

Was it helpful?

Solution

I believe there isn't. I would also use WebDriver API to navigate back. Sometimes it's necessary to use WebDriver API, that's why the WebDriver instance is exposed on Geb's Browser class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top