3
votes

I prepare some test suites for an e-commerce web site, so i use Selenium2Library which requires a running browser on a display. I am able to run these test on my local machine but i had to run them on remote server which does not have an actual display. I tried to use xvfb to create a virtual display but it did not worked, tried all solutions on some answers here but nothing changed.

So i saw pyvirtualdisplay library of Python but it seems like helpful with tests written in Python. I'd like to know that if I am able to run test suites that i wrote in robotframework (which are .txt formatted and could be runnned via pybot) via Python so i can use pyvirtualdisplay?

Sorry about my English, thanks for your answers...

2
you can try python-requests- no need to open browser session - Andersson
@Andersson I checked it but could not made a connection with my question am i missing something? - Kubilay Karpat
Hmm... actually your title (edited) and question don't match: 'if I am able to run test suites...via Python so i can use pyvirtualdisplay?' and 'Is there anyway to run robot framework tests without a display?' seems to be different.. so unexpected answers are expected :) You said "i use Selenium2Library which requires a running browser on a display", i told you how to avoid using Selenium and running browser. Sorry if it was not useful - Andersson
Pyvirtualdisplay seems to be made for running python in virtual display. Your use case is running a browser in a virtual display. Did you try setting DISPLAY environment variable to virtual display before running pybot? - Pekka
@Andersson Sorry about that my first question here, also i was a bit confused. Actually i figured out how to use a virtual display for robot-selenium tests but i still want to learn about this topic. The thing you suggested might help me but i couldnt understand from the result that i reached. And i think your method is valid for selenium tests that written in python? This point is actually what i was wondering but now i think it make not sense now. - Kubilay Karpat

2 Answers

1
votes

If you want to run selenium and not open a browser window you would use PhantomJS. It does not require a display and you can take screenshots.

1
votes

Yes there is with Xvfb installed.

In very short:

/usr/bin/Xvfb :0 -screen 0 1024x768x24&

export DISPLAY=:0

robot your_selenium_test