I am trying to setup a linux box (no display connected) to run as a selenium server. If I connect a monitor and login on the box then I can run the selenium tests no problem. If I try to run the tests via ssh then the tests fail with
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)
I think it has something to do with the display's absence / presence. Any ideas?
PS the browser is firefox 5, the OS is Ubuntu 11.04
I got it to work by using xvfb. So first install xvfb:
sudo apt-get install xvfb
then run it
Xvfb :99 -ac
and then start the selenium server
DISPLAY=:99 java -jar selenium-server-standalone-2.4.0.jar
Here is my answer.
You get this error because there is no monitor to open firefox on, it is getting confused.
Install Xvfb, which pretends to be a monitor, but doesn't show up anywhere.
sudo apt-get install xvfb
If you want less errors add these fonts, but those warning aren't important.
sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
Then start it running and set your display to something the system won't use. Here is what I do, remeber the & makes the terminal run something in the background.
Xvfb :99 -ac &
export DISPLAY=:99
firefox &
Also I was having problems with a ruby on rails server disconnecting when I quit the ssh terminal. To fix that problem use Screen. Screen runs another terminal without being affected by the ssh.
sudo apt-get install screen
Then just start screen before you you do the stuff above.
screen
To get out of the current screen window just click "Ctrl + A" and to get back in type screen -r.
There is a good way to test using imagemagick screen shoot
Install mozilla firefox headless(no GUI)
yum install xorg-x11-server-Xvfb.x86_64 xfonts-base xfonts-75dpi xfonts-100dpi firefox ImageMagick.x86_64
Starts firefox on virtual gui
DISPLAY=:1 firefox http://google.com &
– test and check
Xvfb :1 -screen 1 1024x768x24 &
ps -ef |grep firefox
Uses imagemagic to get a printscreen, to make sure its working.
DISPLAY=:1 import -window root google.com.png
(Optional) Set proxy in firefox profile
vi /root/.mozilla/firefox/ns11i9xo.default/prefs.js
user_pref(“network.proxy.http”, “proxyserver”);
user_pref(“network.proxy.http_port”, 8080);
user_pref(“network.proxy.no_proxies_on”, “localhost, 127.0.0.1, 172.17.0.0/16, 10.5.0.0/16″);
http://felipeferreira.net/?p=1220
Related
I want to use git bash to remotely connect to a PC running Ubuntu Linux and install it using the script code I created.
While I'm installing the packages, the gui screen will occasionally pop up as shown in the image.
How can we create a script command that will instantly push Enter when this screen appears?
I'm not experienced with these problems. I assembled my information and used bash to write my script, however I ran into this issue. I would appreciate it if you could assist me in overcoming this mistake.
Using
sudo apt-get -y
or
sudo apt -y
parameters is not working
I have a GUI application that I would like to set up testing for via GitHub Actions. I already have it set up so that GitHub Actions compiles the application on Ubuntu, but now what I would like to do is run the application for a few seconds and test if it crashes or not. However, currently it fails to start because there is no X11 server installed.
Is there a way that I can install a dummy X11 server, so that the application runs? I don't care about what is actually displayed, I just want the application to be able to open without failing due to the X11 server missing.
Alternatively, is there a way to install a dummy Wayland server? This app can also run on Wayland.
I use this command:
linux:
runs-on: ubuntu-latest
steps:
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
mycommand
You can try xvfb-run from Xvfb project. It starts your application(s) under fully compatible X Window server w/o any hardware (you can even run x11vnc among your apps and connect to the server over VNC, but I believe it's not your case for now). Personally I use xvfb-run for isolated screenless X.org-aware packages build, when, e. g., a package needs to take a snapshot of itself while making documentation.
$ xvfb-run x.org_application_binary
Yes, that is possible. Simply create a Docker Image with your X11 environment and deploy your application in it.
Alternatively, you can also just install X11 on your machine. Make sure to do it in every run, as the environments always fully reset:
sudo apt-get install xorg openbox
I try to run firefox in headless mode for selenium.
$xvfb-run firefox seems to work.
I run firefox through selenium so i cannot run xvfb-run directly.
So i start
Xvfb :1 -screen 0 1024x768x24 &
and then
set DISPLAY:=1
env DISPLAY:=1
Still when i run firefox i get
Error: no display specified
I run on centos 6 and firefox 38 ESR.
What can be done?
can you try that?
export DISPLAY=:1
start firefox with --display arg
/usr/bin/firefox --display=:1
I am using Raspberry pi(s) for workstations in an office setup. I want the users to have access to the intranet and a couple of websites. I have a proxy set up with whitelist that works fine.
I want to boot the RPI and show only a web browser and connect through the proxy. I understand I need a window manager for this.
I have been experimenting with chromium (as it makes it very easy to insert the proxy address as an attribute when opening chromium via command line). The problem is, Chromium is a demanding browser and struggles with JQuery on the RPI.
I am looking for a browser I can run through a proxy, in a window manager from a start up script that won't be slow as hell!
Does this exist? Or am I going down the wrong path for this?
I don't know if this is really what you want but here is one way to boot directly into a web-browser:
1. Make sure you use a Raspberry with the latest version of raspbian installed and updated:
sudo apt-get update
sudo apt-get upgrade
2. If you don't want to use Midori, install the browser you want. I prefer chromium (Light version of Google Chrome) so that's what I will use here. To install chromium run the following command:
sudo apt-get install chromium
3. Configure raspi-config to start in GUI mode:
sudo raspi-config -> Enable boot to desktop/Scratch -> Desktop login as....
4. To start chromium on boot, comment all existing code in the file and add the following last:
sudo nano /etc/xdg/lxsession/LXDE/autostart
#xset s off
#xset -dpms
#xset s noblank
#chromium
On the last line you can also add switches like kiosk mode (--kiosk) after #chromium. Watch this link for more switches:
List of commandline switches
Hope this was any help! Good luck!
I have setup the xvfb server on my headless server and when I m running the
DISPLAY=:99 firefox
I am getting this exception missing RANDR extension
Many of them said to disable some xinerna from the xorg.conf file but this file is not getting created in my case.
So I am searching for how to add the missing RANDR extension.
I am seeing this error message when I run Firefox headless through selenium using xvfb. It turns out that the message was a red herring for me. The message is only a warning, not an error. It is not why Firefox was not starting correctly.
The reason that Firefox was not starting for me was that it had been updated to a version that was no longer compatible with the Selenium drivers that I was using. I upgraded the selenium drivers to the latest and Firefox starts up fine again (even with this warning message about RANDR).
New releases of Firefox are often only compatible with one or two versions of Selenium. Occasionally Firefox is released with NO compatible version of Selenium. When that happens, it may take a week or two for a new version of Selenium to get released. Because of this, I now keep a version of Firefox that is known to work with the version of Selenium that I have installed. In addition to the version of Firefox that is kept up to date by my package manager, I have a version installed in /opt/ (eg /opt/firefox31/). The Selenium Java API takes an argument for the location of the Firefox binary to be used. The downside is that older versions of Firefox have known security vulnerabilities and shouldn't be used with untrusted content.
First off, Xvfb doesn't read configuration from xorg.conf. Xvfb is a variant of the KDrive X servers and like all members of that family gets its configuration from the command line.
It is true that XRandR and Xinerama are mutually exclusive, but in the case of Xvfb there's no Xinerama in the first place. You can enable the XRandR extension by starting Xvfb using at least the following command line options
Xvfb +extension RANDR [further options]
I had the same problem with Firefox 30 + Selenium 2.49 + Ubuntu 15.04.
It worked fine with Ubuntu 14 but after upgrade to 15.04 I got same RANDR warning and problem at starting Firefox using Xfvb.
After adding +extension RANDR it worked again.
$ vim /etc/init/xvfb.conf
#!upstart
description "Xvfb Server as a daemon"
start on filesystem and started networking
stop on shutdown
respawn
env XVFB=/usr/bin/Xvfb
env XVFBARGS=":10 -screen 1 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset"
env PIDFILE=/var/run/xvfb.pid
exec start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --exec $XVFB -- $XVFBARGS >> /var/log/xvfb.log 2>&1