问题
My Selenium headless tests are triggered from Jenkins server and run in EC2-Ubuntu. I want to view the test live on Chrome so I installed Xvfb plugin on Jenkins.
On EC2 I installed Xvfb. When I start executing the build, my test starts execution and I see below logs:
Xvfb /usr/bin/Xvfb :1 -fbdir /var/lib/jenkins/xvfb
27-..fbdir13700092919317283985
Parsing POMs
Established TCP socket on 30810
and I see the test is running successfully.
Now I do SSH to EC2 from Mac terminal by
ssh -L 5901:localhost:5901 qa_user@10.113.x.xxx
Then I execute:
qa_user@jenkins-it:~$ export DISPLAY=: 30810` (Port number from Jenkins logs above)
qa_user@jenkins-it:~$ vncserver "$DISPLAY" -geometry 1280x1024
New 'X' desktop is jenkins-it: 30810
Starting applications specified in /home/qa_user/.vnc/xstartup
Log file is /home/qa_user/.vnc/jenkins-it: 30810.log
qa_user@jenkins-it:~$ x11vnc --listen 0.0.0.0 -rfbport 5901 -display : 30810
This starts XVFB and I see:
Now when I connect from Mac to localhost:5901 from VNCviewer, I am taken to Ubuntu desktop.
But I don't see chrome opening up even though the test is running and I see test logs on Jenkins.
I am also able to use Chrome via VncViewer.
What am I missing here? I tried many Xvfb set up instructions and has been trying to get this right since a month now. Here are few questions I asked:
https://askubuntu.com/questions/1262925/run-selenium-tests-on-ec2-with-gui?noredirect=1#comment2139716_1262925
How to view live headless Selenium tests on EC2-Ubuntu using vncserver and xvfb
https://sqa.stackexchange.com/questions/45376/looking-for-a-solution-to-run-selenium-tests-on-ec2-with-gui/45380#45380
Long way till here and now Stackoverflow is my last resort. Please help.
来源:https://stackoverflow.com/questions/63509097/xvfb-and-selenium-on-ec2-unable-to-view-chrome-ui-on-vnc-viewer