I have the following setup for my selenium tests:
Hub machine in Linux. Couple of virtual machines as nodes, Linux and Windows created using Vagrant scripts.
If I start selenium node in Linux machine using vagrant script (as part of the provisioning), I am not able to run the selenium tests. But if I login to Linux box and run exactly the same script, I can run the tests.
I enabled the log, an what I se ein log is "cannot set DISPLAY". I am quite sure it is something to do with setting DISPLAY variable. But set the display and didn't work.
So, any of you have faced this or can help me?
Content of Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
NODE_COUNT=Integer(ENV["NODE_COUNT"])
Vagrant.configure("2") do |config|
(1..NODE_COUNT).each do |i|
config.vm.define "node#{i}" do |subconfig|
subconfig.vm.box = "ubuntu_18_04"
subconfig.vm.network "private_network", type: "dhcp"
subconfig.vm.boot_timeout = 600
subconfig.vm.graceful_halt_timeout = 600
# config.disksize.size = '50GB'
subconfig.vm.provision "shell", path: "provision.sh"
subconfig.vm.provision "shell", path: "startup.sh", run: 'always'
#subconfig.vm.provision :reload
end
end
end
Content of startup.sh
echo "start selenium node"
HOST_IP=`ifconfig | grep 172| cut -d" " -f 10`
java -Dwebdriver.chrome.driver="/home/vagrant/test/node_modules/electron-chromedriver/bin/chromedriver" -jar "/home/vagrant/test/selenium-server-standalone.jar" -role node -hub http://172.28.128.1:4444/grid/register/ -browser "browserName=chrome,maxinstances=1,platform=LINUX" -host $HOST_IP &