Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain resetBrowser() + clearCacheAndQuitDriver() trick in Book of Geb #473

kriegaex opened this issue Feb 20, 2017 · 2 comments


Copy link

kriegaex commented Feb 20, 2017

After I had answered a StackOverflow question about how to restart a browser within a test here in a rather complicated way and @erdi offered a much simpler solution here I am creating this tracking ticket:

OMG, this works and I had to use such a complicated workaround, searching my eyes out in the Book of Geb (BoG) and elsewhere. Would you mind adding this to chapters 3.1 or 3.2 where you talk about life cycle management? resetBrowser() is not mentioned a single time in the whole BoG, not to speak of the combination with clearCacheAndQuitDriver(). To document this in the BoG would be really helpful. resetBrowser() is also undocumented in the JavaDoc.

For reference, this is a simple use case:

package de.scrum_master.tdd

import geb.driver.CachingDriverFactory
import geb.spock.GebReportingSpec

class RestartBrowserIT extends GebReportingSpec {
  def "Search web site"() {
    go ""
    report "welcome page"

    $("h2").text().startsWith("Herzlich Willkommen bei")

    when: "browser is reset"

    and: "download page is opened in new browser"
    go ""
    report "download page"

    then: "expected text if found on page"
    $("h2").text().startsWith("Scrum on a Page")
@erdi erdi self-assigned this Jul 20, 2018
@erdi erdi added this to the 2.2 milestone Jul 20, 2018
Copy link

kriegaex commented Aug 3, 2018

I took a quick look over your commit. The test case looks more condensed and elegant than mine, the text is also comprehensive. Thanks!

Copy link

erdi commented Aug 3, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants