Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
'phantomjs' executable needs to be in PATH

Open 1 Answers 74 Views
0 1
I am one a ubuntu 16.04 server.

A lot of the time I run code with phantom js I get the error 'phantomjs' executable needs to be in PATH.

However, I have put the path in as /usr/local/bin/phantomjs.

1 Answer

0
0

Download the most recent selenium java bindings - 2.45. Then remove the 2.44 (or whatever you're using) from your library.

Then include the following in your code:

DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);                
caps.setCapability("takesScreenshot", true);  
caps.setCapability(
                        PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                        "your custom path\\phantomjs.exe"
                    );
WebDriver driver = new  PhantomJSDriver(caps);

 

answered by (202 points)
1Comments
commented by (202 points)
As phantom is probably installed in /usr/local/bin, you should add that dir to PATH in your crontab. The following should do the trick:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...