controlling Firefox using Perl

Gary Stainburn <[email protected]>
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <[email protected]>
Can anyone please point me to decent documentation for controlling 
Firefox using perl?

I am open to any solution, but I have already looked at both 
Selenium::Firefox, and Selenium::Remote::Driver.

I have Selenium::Firefox working on a Centos 7 box, but I can't find any 
documentation on how to use it. So far, all I have managed to do is open 
a web browser window, and get a web page and extract it's contents.

I also have a working Selenium::Remote::Driver setup with a perl script 
on a Centos 7 box controlling IE11 on a Win10 box.

I have spent all day going round in circles with Google finding out of 
date articles, and links pointing back to each other without success. I 
can't even find any doc's on using Selenium::Firefox on the cpan pages 
for the module.

I have gone through dependency hell installing Selenium::Remote::Driver 
on a new Centos 7 box.  I then  installed Java and 
selenium-server-standalone-2.53.1.jar. However, when I try to run a 
script to open a local Firefox window I get the error below on the 
selenium-server.

Again, most of the articles relating this problem are old, circa 2016, 
and refer to version compatibility issues.

Any advice welcome.

Gary

13:30:25.459 INFO - Executing: [new session: Capabilities 
[{acceptSslCerts=true, browserName=firefox, javascriptEnabled=true, 
version=, platform=ANY}]])
13:30:25.469 INFO - Creating a new session for Capabilities 
[{acceptSslCerts=true, browserName=firefox, javascriptEnabled=true, 
version=, platform=ANY}]
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to 
host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

         at 
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
         at 
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
         at 
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
         at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 

         at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 

         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
         at 
org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91) 

         at 
org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68) 

         at 
org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60) 

         at 
org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222) 

         at 
org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1) 

         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         at 
org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176) 

         at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 

         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 

         at java.lang.Thread.run(Thread.java:748)
13:31:10.967 WARN - Exception thrown
java.util.concurrent.ExecutionException: 
org.openqa.selenium.WebDriverException: 
java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 
17:37:03'
System info: host: 'study.stainburn.com', ip: '192.168.1.193', os.name: 
'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', 
java.version: '1.8.0_282'
Driver info: driver.version: unknown
         at java.util.concurrent.FutureTask.report(FutureTask.java:122)
         at java.util.concurrent.FutureTask.get(FutureTask.java:192)
         at 
org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)
         at 
org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)
         at 
org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)
         at 
org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:124)
         at 
org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)
         at 
org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
         at 
org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)
         at 
org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79)
         at 
org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
         at 
org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at 
org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
         at 
org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
         at 
org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
         at 
org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
         at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
         at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
         at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
         at 
org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
         at 
org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
         at 
org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
         at 
org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
         at 
org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
         at 
org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: 
java.lang.reflect.InvocationTargetException
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 
17:37:03'
System info: host: 'study.stainburn.com', ip: '192.168.1.193', os.name: 
'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', 
java.version: '1.8.0_282'
Driver info: driver.version: unknown
         at 
org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:101)
         at 
org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68)
         at 
org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
         at 
org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
         at 
org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         at 
org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
         at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
         at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
         at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
         at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
         at 
org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91)
         ... 9 more
Caused by: org.openqa.selenium.WebDriverException: Failed to connect to 
binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output 
follows:

Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 
17:37:03'
System info: host: 'study.stainburn.com', ip: '192.168.1.193', os.name: 
'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', 
java.version: '1.8.0_282'
Driver info: driver.version: FirefoxDriver
         at 
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:124)
         at 
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
         at 
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
         at 
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
         ... 14 more
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to 
connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console 
output:

         at 
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
         ... 19 more
13:31:10.971 WARN - Exception: Unable to connect to host 127.0.0.1 on 
port 7055 after 45000 ms. Firefox console output:




-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.