Closed danclaudiupop closed 8 years ago
It should really be up to the calling code to handle this exception. This pull request removes control from the caller and ultimately would make this library unusable for me personally (often teardowns of other sorts are required after xvfb is not found).
I suggest you handle the OSError in a manner similar to the following in your code:
from xvfbwrapper import Xvfb
def main():
# TODO create your Selenium object and initialise the browser
xvfb = Xvfb()
try:
xvfb.start()
# TODO run some selenium tests here
xvfb.stop()
except OSError:
print(
'Error: xvfb cannot be found on your system, please install '
'it and try again')
exit(1)
finally:
# TODO clean up Selenium browser
if __name__ == '__main__':
main()
Cheers Fotis
I installed xvfb using the command (It went fine):
sudo pip install xvfbwrapper
When i try to use xvfb (ubuntu 12.04 , python)
from xvfbwrapper import Xvfb
vdisplay = Xvfb() vdisplay.start()
It throws traceback:
Traceback (most recent call last):
File "
Can any one help me with this?
I think you missed to install XVFB:
sudo apt-get install xvfb
Thanks danclaudiupop. I missed it. Working fine now
Hi,
If xvfb is not installed, and running the tests, the following output is generated:
I prepared the app for OSError exception and provided a more friendly error message. Also, this makes it so we can run the tests even if we didn't start the tests from an X session.