I followed Web page Capture and save to image using phantomjs lib and able to save screenshot on my local.
However when executing PhantomJS command with Jenkins, following error is generated: "_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL." and screen shot is not saved on Jenkins.
Can anyone please guide me?
I've found two possible solutions to this problem:
As user2325313 commented, if you login as the Jenkins' user you should be able to avoid this issue.
Run Jenkins as a standalone application instead of a daemon. To do so, locate your Jenkins .war file and execute it from the terminal using the following command :
java -jar /Applications/Jenkins/jenkins.war
Related
I have just recently started learning about APIs as party of Full stack developer course. Everything has been working fine until I have activated system storage sense in Windows to clear some space in the disk /c, the curl command stopped working and is giving internal server error.
curl calling request error using bash terminal
I have realized there is an issue when I have run my code and it stopped pulling information from the API link.
Since you made a windows change my guess would be - try addding the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt.
I have installed Phantomjs 1.9.8 on my Centos 6.5 server.
From the command line if I type
phantomjs -v
I get the correct version number returned, so I presume that it is installed ok.
However if I create a simple javascript file, using the most basic example from the phantomjs example:
console.log('Hello, world!');
phantom.exit();
and save this to a file test.js, navigate to that folder via command line and run
phatomjs test.js
I get
PhatomJS has crashed... Segmentation fault.
Any idea what could be causing this or further tests I could run?
A simple solution - A key step of course is that you have to restart your apache web server to get this to work, I had forgotten this.
Leaving this up in case it helps anyone else stumbling along the same route
I inherited a project where the person wrote tools to test our site's UI using JQuery and JS.
I don't know too much about it other than it requires a browser to be spawned and I think the tool uses JS to interact with iframes to see if it's the expected values.
My job is to get this tool to run on a remote server and post the results to Jenkins.
The remote test server and staging server is linux. From our staging server, I want to write a script to spawn a browser and run cmds from the tool to test our UI. I ran the following manually:
ssh -X user#remote_test_server /usr/bin/firefox
However, the remote server says:
Error: no display specified
Is there a way to spawn a browser for automated testing from one headless server to another? Thanks in advance for your help.
I faced a similar problem when I tried to automate a GUI installation program. While there are quite some different possibilities to choose from (e.g. Xnest, Xephyr?), I ended up using vncserver, because it's relatively easy to debug the GUI session this way.
You need to create a vncpassword file, I think:
mkdir -p $HOME/.vnc
chmod 0700 $HOME/.vnc
echo MyLittlePassword | vncpasswd -f > $HOME/.vnc/passwd
chmod 0600 $HOME/.vnc/passwd
Starting the server is then quite straightforward
vncserver
export DISPLAY=:1
/usr/bin/firefox&
...
Now it is possible to connect to the VNC server with a VNC viewer of your choice. But beware there may be no window manager, depending on the X startup scripts of your environment.
Shutting the server down
vncserver -kill :1
In the configuration of Jenkins project , specify the
Build Environment
Start Xvfb before the build, and shut it down after.
#
I am trying to get this example to work. It works fine when I click the link. But when I try to download the HTML file on my local machine and try the same, it is throwing this error.
Not allowed to load local resource: blob:null/6771f68d-c4b8-49a1-8352-f2c277ddfbd4
The line of code that seems to be causing the issue is this,
video.src = window.URL.createObjectURL(mediaSource);
What this line of code is doing is basically trying to set the source of the video tag media element to the MediaSource object. I have tried various permutations without much luck.
I am using Chrome Version 28.0.1500.72 m, which is the latest stable release.
I would appreciate any pointers.
As #dandavis has said, "run it from http: not file".
I'm posting this as an answer for the sake of organization.
For starters:
Running you project from http means having a http server (such as apache or a simple node http-server) and running your project via http://localhost.
Install http-server globally using npm command(provided you have installed Node.js in your system beforehand). Navigate to your file folder in CMD and type http-server. Your app should run in localhost:8080.
I started playing around with JSTestDriver tonight and got it to work without too many issues. I attempt use the --browser switch to have it autocapture chrome or firefox on my local system here; however, it always threw an error saying "permission denied". I attempted to run the command using sudo and still the same thing.
java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.3.2.jar --port 4224 --browser /Applications/Firefox.app
I can open Firefox using the above path from Terminal so know that the path is valid.
I feel like I'm missing something simple and small. Has anyone seen this issue and know what I'm missing?
UPDATE 1:
Tried to move Firefox out of the /Applications/ directory and still same issue even running under the super user account (using sudo).
Found my issue.
While /Applications/Firefox.app is what's shown the GUI, the actual executable script for the program is in the /Applications/Firefox.app/Contents/MacOS/firefox file.
Changing the path to the deeper folder resolved the issue.