Using VMRUN to execute selenium process in Ubuntu VM without XVFB - bash

I'm using vmrun.exe from VMware Workstation to start an Ubuntu 16 desktop VM and launch a Java selenium Firefox process in it. I can start and launch the script however I would like the selenium process to be visible in case a user would like to monitor it. It gives the following error when trying to launch firefox with a visible GUI.
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/home/vmdops/firefox/firefox) on port 7055; process output follows:
Error: GDK_BACKEND does not match available displays
The following bash script is used to launch the process
java -jar seleniumProcess.jar
I can execute the process headless with XVFB and run the selenium process in memory however then I cannot view the process running visually.
/usr/bin/Xvfb :1 & export DISPLAY=:1
java -jar seleniumProcess.jar
What is the proper terminology to explain why the firefox browser cannot be displayed?
Is there anyway to launch the selenium process from VMRUN that allows the firefox browser to display normally?
Thanks
Conteh

I was able to resolve the issue adding -interactive to the end of the command
vmrun -T player -gu vmdops -gp xxxx runScriptInGuest "C:\VMDOPS2\VMDOPS2.vmx" /bin/bash "sh /home/vmdops/autovpn/runProfiler.sh" -interactive
This works when the use is already logged in interactively. When I launch too quickly after starting the vm I get the following error.
Error: The specified guest user must be logged in interactively to perform this operation
So one must wait a while after booting.

Related

How to start a foreground process even if its parent is a Windows service or daemon process?

I have a parent process which stared as a service. This service needs to start RobotFramework.
If Robotframework did not start foreground, Selenium test library will complain when starting the browser (Chrome) and fail.
for example, i have a testcase like:
test.txt
***setting***
Library SeleniumLibrary
***test case***
open_browser
Open Browser www.stackflow.com chrome
i run test.txt from a windows service process, by invoke command like
pybot test.txt
since pybot`s parent is a service ,so, pybot also become a backgroud process, and this result selenum complain open brower failed
What should I do to make RobotFramework start on the foreground? Or is there another way to make Selenium work properly?

How to run selenium server in the background using windows batch script in Jenkins?

I am running protractor tests on a server machine through Jenkins. I need to start the selenium web driver before running the tests. i.e. "webdriver-manager start" and run the tests while the server is running and shut it down once tests are run. How do I do this using batch script?
I am using start, cmd commands in the batch file to achieve it but once the selenium server starts, I am unable to go back to the prompt unless I stop it.
How to I make it run in the background by staying in the same command prompt window rather than opening up the new command prompt window selenium server starts?
you should run webdriver-manager start as shell script.
Make sure
1 - Node.js installed on jenkins
2 - provide correct path to webdriver-manager

Debug meteorjs application with node-inspector

I am trying to debug a meteor application at server side.
I created an environment variable export NODE_OPTIONS='--debug'.
I run meteor (version 0.7.0.1) command. It tells the debugger listening on port 5858.
I start node-inspector (version v0.7.0-2) and point to 127.0.0.1:8080/debug?port=5858, but I can see only a couple of strings, Source, Console and a prompt > where I cannot write anything.
I have this error in the console:
“The connection to ws//127.0.0.1:8080/socket.io/1/websocket/Za… was interrupted while the page was loading”.
The same if I use 0.0.0.0:8080: I can see something more of the debugger on the right panel, as Watch expression, Call stack, but the Source list is still empty.
Node-inspector should be listening, because if I stop meteor says that the remote debugging has been terminated. I cannot figure out what I am doing wrong.
have a look at https://groups.google.com/forum/#!topic/meteor-talk/EG8pe7pF3f8
Just want to share some of my experience on using node-inspector to
debug server side codes:
1. When you run Meteor, it will spawn two processes on Linux machine
(Note: I have not checked this on Windows or Mac machine)
process1: /usr/lib/meteor/bin/node /usr/lib/meteor/app/meteor/
meteor.js
process2: /usr/lib/meteor/bin/node /home/paul/codes/bbtest_code/
bbtest02/.meteor/local/build/main.js --keepalive
You need to send kill -s USR1 on process2
Run node-inspector and you can see your server code
On my first try, I modify the last line on meteor startup script in /
usr/lib/meteor/bin/meteor to
exec "$DEV_BUNDLE/bin/node" $NODE_DEBUG "$METEOR" "$#"
and run NODE_DEBUG=--debug meteor on command prompt. This only put --
debug flag on process1 so I only see meteor files on node-inspector
and could not find my code.
Any suggestion on how to modify the script so we can use "--debug"
flag on the meteor script?
Cheers,
Paul

Issue with IOS Instruments running from command line on build machine

I've successfully run IOS UI Automation Instruments from command line on my local Mac. When it starts to test, the simulator will automatically pop up and then do the stuff.
However, when I SSH to a build server (with OSX and xcode, will use Jenkins eventually) and try to do the same thing, it doesn't work well.
Building process is fine, but as long as I run instruments, the terminal will then hang there without doing anything. I figure it has something to do with iphone simulator GUI but since it's CLI, I don't know what's going on...
Do you guys have any idea? Thanks!!
.
After executing the command from Jenkins through SSH; in most cases you would see a pop up window as in the screen shot. You will have to get past this screen to execute your tests. This post addresses how to get past that issue Stop "developer tools access needs to take control of another process for debugging to continue" alert
I've had the same issue. instruments -w "$DEVICE" were ignoring parameters.
Same with
DEVICE_TARGET='iPhone 6 (8.1 Simulator)' cucumber --format json -o test-reports/cucumber-8.1-iphone.json
It were ignoring DEVICE_TARGET parameter.
Solved via running Jenkins slave NOT as a SSH slave but as the Slave agent via java web start
http://i.stack.imgur.com/lNlPA.png
As i understand this issue is caused by OS X launchagent that managing sshd and performs scope of restrictions for remote users.
IMPORTANT! Slave agent should be started from OS X desktop, not via ssh! I've connected via VNC and launched slave java web agent on the OS X UI terminal.

Selenium RC test (PHPUnit)

Using, Centos, Apache, PHPUnit, Selenium RC,
I was trying to test selenium RC which is running in one of my server.
java -jar selenium-server-standalone-2.4.0.jar
Initially i got error of firefox creating profile and it doesnot load anything up and gives error.
Secondly i tried to do with given profile location.
java -jar selenium-server-standalone-2.4.0.jar -firefoxProfileTemplate
"/root/.mozilla/firefox/" &
still it shows error
ERROR - Failed to start new browser session, shutdown browser and
clear all session data
INFO - Got result: Failed to start new browser session: Error while launching browser on session null
Please share your view what may be the problem,
Running Mock , it is working, for test purpose, but firefox, is unable to lunch browser session.
Note: its not GUI mode (NO X), it has firefox version 3.6.18,
09:48:20.312 INFO - Got result: Failed to start new browser session: Error while launching browser on session null
09:48:39.659 INFO - Command request: getNewBrowserSession[*firefox3, http://google.co.uk] on session null
09:48:39.659 INFO - creating new remote session
09:48:39.660 INFO - Allocated session 17b9149077f648d3bc89b3f106466c6c for http://google.co.uk, launching...
09:48:39.860 INFO - Preparing Firefox profile...
09:49:00.017 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:114)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:83)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:412)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:375)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:87)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:785)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:422)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:393)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:146)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
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:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
09:49:00.048 INFO - Got result: Failed to start new browser session: Error while launching browser on session null
After, a whole day research, i got the solution, which may be useful for all of you if this is the case..
If Any issue: Due to the Display issue you may face several problem, such as firefox profile, and firefox lunching, and not being able to load.
Firefox Profile Issue: Copy and paste from another machine if you dont have in given machine.
Firefox Lunching Issue: With No session on null: yum install xorg-x11-Xvfb && Xvfb :99 -ac && export DISPLAY=:99 && firefox
Here if you see any issue regarding xvfb :99 you may have to delete the lock file.
Server is already active for display 99
If this server is no longer running, remove /tmp/.X99-lock
and start again.
Firefox should launch without error, and stay running (until you kill it with Control-C)
It kept giving me the same error(ERROR - Failed to start new browser session, shutdown browser and clear all session data) regardless of what i did. I am running Selenium on a linux box with firefox installed and i am trying to run it headless.
Here is how i resolved the issue:
1.Install xvfb(a virtual display manager) and its dependencies
sudo apt-get install xvfb
sudo apt-get apt-get install libgl1-mesa-dri xfonts-cyrillic xfonts-100dpi xfonts-75dpi
2.Run xvfb like this
sudo Xvfb :99 -ac
This should get it running on display :99. You will see some output
3.Open a new terminal and type this.
export DISPLAY=:99
java -jar selenium-server-standalone-2.37.0.jar
This will set the display to :99. So anything opened from that terminal window that needs to use display will open on the virtual display(which is invisible) managed by xvfb. The second line starts the selenium server, and since selenium will attempt to start firefox, it will start it on this invisible display.
Then run your test. This should get the test setup and the browser will be invisible.

Resources