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.

2
  • I am having this problem on Windows with Geb 0.10. I've submitted a lengthy edit describing the problem in more details and adding more comments. Jun 15, 2015 at 19:23
  • Let me also note that the script I posted works just fine from the command line. Jun 16, 2015 at 11:35

2 Answers 2

2
+200

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.

1
  • Works for me through groovyConsole. Thanks! Jun 18, 2015 at 17:51
-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:

1
  • 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, 2014 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.