Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

0
'phantomjs' executable needs to be in PATH

Open 1 Answers 31 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 (200 points)
1Comments
commented by (200 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.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors

...