しもむブログ

技術メモ。といっても高度なことは書けないので…初心者がハマったところや、ググってもすぐには出てこないようなものを書くつもり。

Gebでブラウザとドライバーのバージョンが合っていない時に出るエラー

はじめに

  • Gebで不思議なエラーに悩まされた時の話です。
  • Gebについてはぷーさにさんの記事が詳しいので割愛します。

codezine.jp

  • Yokohama.groovy #42Gebについて学んだ後、ひさしぶりに動かしてみると全然動きません。
  • 原因はブラウザのドライバーのバージョンが古かったからなのですが、エラーからは直接わからず…
  • そこでバージョンが合っていないとどんなエラーが出るか試してみました(とりあえずChrome Driverだけ)。

その1

  • Chromeが真っ白な画面で止まる

f:id:mshimomu:20171217133655p:plain

GebishOrgSpec > Gebのホームページが表示できる FAILED
    geb.driver.DriverCreationException
        Caused by: org.openqa.selenium.remote.UnreachableBrowserException
            Caused by: org.openqa.selenium.WebDriverException
                Caused by: org.apache.http.conn.HttpHostConnectException
                    Caused by: java.net.ConnectException

その2

  • Chromeが立ち上がってすぐ落ちる
GebishOrgSpec > Gebのホームページが表示できる FAILED
    geb.driver.DriverCreationException
        Caused by: org.openqa.selenium.SessionNotCreatedException

その3

GebishOrgSpec > Gebのホームページが表示できる FAILED
    geb.driver.DriverCreationException at GebishOrgSpec.groovy:7
        Caused by: org.openqa.selenium.WebDriverException at GebishOrgSpec.groovy:7
    geb.driver.DriverCreationException
        Caused by: org.openqa.selenium.WebDriverException
    geb.driver.DriverCreationException
        Caused by: org.openqa.selenium.WebDriverException

終わりに

  • ひさしぶりにGebを動かしてみてよくわからないエラーが出たらドライバーのバージョンを疑ってみるのも1つかと思います。
  • 明日はuehajさんです。よろしくお願いします!