山pの楽しいお勉強生活

勉強の成果を垂れ流していきます

Gebをはじめる時に遭遇する例外の対処について #gebAdvent

お約束?

この記事は「Geb Advent Calendar 2016」の3日目の記事です。*1

はじめに

私は、少し前にGeb(じぇぶ)を触ったことがありました。
ただ、久しぶりに再び触ってみたらやたらとエラーやら例外に遭遇したので、その例外と対処法を紹介します。

最初に結論

  • 各種関連ツールのバージョンは最新にしましょう
    • Java
    • Groovy
    • ブラウザ
    • Driver

とりあえず始める前に上記をチェック!!
1つ前のバージョンでも動作しなかったりします。

遭遇するエラーやら例外

下記以外のエラーや例外も発生した記憶がありますが再現できませんでした。。。

  • Groovyのバージョンが低い時
    • 2.4.7が最新の際に2.4.4で発生。
    • 1つ前の2.4.6でも発生した記憶あり
Caught: BUG! exception in phase 'conversion' in source unit 'C:\work\github\work\20161118_geb\code.groovy' # Licensed to the Apache Software Foundation (ASF) under one or more
BUG! exception in phase 'conversion' in source unit 'C:\work\github\work\20161118_geb\code.groovy' # Licensed to the Apache Software Foundation (ASF) under one or more
Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more
  • Javaのバージョンが低い時
    • 1.8.0_112が最新の際に1.8.0_20で発生。
    • 1.8.0._60辺りでも発生した記憶ありますが再現せず。
Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 29345
Only local connections are allowed.
12 04, 2016 3:47:40 �ߌ� org.openqa.selenium.remote.ProtocolHandshake createSession
����: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
12 04, 2016 3:47:43 �ߌ� org.openqa.selenium.remote.ProtocolHandshake createSession
����: Detected dialect: OSS
Caught: java.lang.VerifyError: Bad <init> method call from inside of a branch
Exception Details:
  Location:
    geb/navigator/SearchContextBasedBasicLocator.<init>(Lorg/openqa/selenium/SearchContext;Lgeb/navigator/factory/NavigatorFactory;)V @91: invokespecial
  Reason:
    Error exists in the bytecode
(略)

*1:遅れて申し訳ありません orz