1

I am trying to do some really simple bare bones inline coding with Geb in the Groovy Console.

I installed Groovy, downloaded the Geb jar and have Selenium downloaded.

I have opened the console and pasted in the very simple :-

@Grapes([
@Grab("org.codehaus.geb:geb-core:0.7.2"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.28.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.28.0")
])

import geb.Browser

Browser.drive {
 go "http://google.com/"
 assert title == "Google"
}

When I run this, Firefox opens and hangs on a blank page for ages before the console responds with a spam of errors that is too long to post here.

So I put it on PasteBucket
Link -> http://www.pastebucket.com/40187

I am really struglging to just get started with Geb. I had no problems taking off with Selenium Webdriver and doing automation via Java scripts, but after a few hours of struggling through vague or overly complex guides I am still unable to make even the simplest Geb script run.

Any assistance would be greatly appreciated. I feel like I have missed some important steps.

Farrell Coleman
  • 79
  • 3
  • 15

2 Answers2

2

On line 162 in the error link I can see:

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows:

I have tried the example in the Eclipse with dependencies as listed here (selenium jars version 2.43.1) and got similar error:

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

Then I have switched to latest jars version 2.46.0 as per Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms and it worked just fine. My Firefox version is 38.0.5 (latest in the moment)


Why doesn't it work with the old version? A tcp connection was half open

TCP 127.0.0.1:57855 127.0.0.1:7055 SYN_SENT 6760

and thread dump showed that main thread tries to read from the socket:

Thread 1: (state = IN_NATIVE) -java.net.DualStackPlainSocketImpl.connect0(int, java.net.InetAddress, int) @bci=0 (Interpreted frame) -java.net.DualStackPlainSocketImpl.socketConnect(java.net.InetAddress, int, int) @bci=28, line=79 (Interpreted frame) ...................................................... -org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(java.lang.Object, java.lang.Object, java.lang.Object) @bci=7, line=120 (Interpreted frame) -org.toni.geb_test_jar.GebTestSimple.main(java.lang.String[]) @bci=13 (Interpreted frame)

which makes me think the part of the driver which runs in Firefox was hanging for some reason.

Community
  • 1
  • 1
Anton Krosnev
  • 3,964
  • 1
  • 21
  • 37
-1

You didn't really ask a question... but your implied question is: "How do I get started with Geb?"

I have an example Geb project on GitHub and a few screencasts on how to get started with Geb on my blog:

Brine
  • 3,733
  • 1
  • 21
  • 38
  • 1
    Let me disagree with you. The question is about why it doesn't works as written in tutorial. But you provide a few more 'getting started'. – olyv May 25 '14 at 15:44