0

I can run my selenium tests from within Eclipse with no issues by right clicking .java file within Eclipse, and selecting Run as TestNG Test. Firefox driver is started up, tests run as expected.

Environment:
Windows 8.1 64 bit
selenium 2.50.0
Firefox 36 (auto update turned off - a bit behind).  

However, when the same test is run using ant - build.xml file, this results in completely different behavior:
Firefox browser starts, but I always get the Unable to connect to host on port 127.0.0.1 on port 7055 error.

My best guess is this has something to do with the 64 bit OS and the fact that Firefox doesn't seem to support 64 bit, but I don't know why it is working via Eclipse? I feel like I have tried just about everything, shy of starting over from scratch with a new 32 bit machine. Any help would be greatly appreciated. I've been spinning on this way too long.

Frederik Struck-Schøning
  • 12,981
  • 8
  • 59
  • 68
AndyB
  • 31
  • 8
  • You are running both eclipse and ant on the same server right? – nilesh Feb 03 '16 at 22:21
  • Yes. Eclipse and ant are both running on the same machine. – AndyB Feb 03 '16 at 22:34
  • Have you seen [this](http://stackoverflow.com/questions/12588082/webdriver-unable-to-connect-to-host-127-0-0-1-on-port-7055-after-45000-ms) already? – nilesh Feb 03 '16 at 22:38
  • Yes. Usually whenever I see the 'unable to connect to host' error I upgrade my selenium jar files to solve the issue. For some reason the only combo of FF and selenium I could get to work on this box was selenium (java) 2.50.0 (haven't tried 2.50.1 yet) with FF 36. Anything newer than 36 prevents my tests from running in Eclipse. So when I finally got it working in Eclipse I figured I was golden, but then I was unable to get past the error from the command line using ant. Banging my head. – AndyB Feb 03 '16 at 22:49
  • Are you using `selenium webdriver` or `selenium rc`? And that was nothing to do with the machine bit length, I believe. See if [this](http://stackoverflow.com/questions/12588082/webdriver-unable-to-connect-to-host-127-0-0-1-on-port-7055-after-45000-ms) helps, a possible duplicate. – Rao Feb 04 '16 at 09:23
  • See if ant is compiling jar in proper sequence, I believe you may end up in jar conflict. Are you using selenium webdriver jar along with selendroid or appium jar ?? – Pankaj Kumar Katiyar Feb 04 '16 at 10:49
  • Rao - yes I checked that several times as Nilesh also suggested before posting this question. Seems like the same symptoms, but the cause in this case appears to be different. As Eclipse works but ant does not. Pankaj - I had that same thought, but have been unable to figure out how to change the sequence order. My ant build.xml file contains a var 'ws.jars', which is pointing to a folder containing all my jar files. Do you know of a way to ensure sequence order of jar files? – AndyB Feb 04 '16 at 14:42
  • I'm using Appium or Selendroid jar files, but I do have some Applitools jar files in that ws.jars folder, that may be causing the conflict. I will remove those and see if it makes a difference. – AndyB Feb 04 '16 at 14:56
  • Correction on my last comment. I am NOT using Appium or Selendroid. I am using Applitools. – AndyB Feb 04 '16 at 15:41

1 Answers1

0

PanKaj - that was the issue! After I removed the jar files included from the Applitools package, my problem went away. So thank you for your insight, my tests now work from the command line and thus Jenkins. I just have to figure out a way to use the jars I need for Applitools + plus the jar files I need to drive the Firefox Browser without any conflicts. One step at a time.

Thanks all and hopefully this can be helpful to others!

Update: I was able to alter my ant build.xml file and force a specific sequence order and get everything working. My old build.xml:

<property name="ws.jars" value="C:\\All Jar files"/>

My new build.xml:

<property name="ws.jars1" value="C:\\All Jar files\\OAuth2_Jars"/>
<property name="ws.jars2" value="C:\\All Jar files\\selenium-2.50.0"/>
<property name="ws.jars3" value="C:\\All Jar files\\Additional Jar Files"/>
<property name="ws.jars4" value="C:\\All Jar files\\eyes-selenium-java-2.22_2_22"/>
...
<path id="classpath_jars">
<fileset dir="${ws.jars1}" includes="*.jar"/>
<fileset dir="${ws.jars2}" includes="*.jar"/>
<fileset dir="${ws.jars3}" includes="*.jar"/>
<fileset dir="${ws.jars4}" includes="*.jar"/>
</path>

Everything is working great now!

AndyB
  • 31
  • 8