Reputation: 44385
I am trying to use pyvirtualdisplay
in selenium tests in order to create screenshots. Here is how I do it in the tests within a TestSuite python class:
self.display = Display(visible=0, size=(1366, 768))
self.display.start()
before creating the driver, and to take the screenshot I use
self.driver.save_screenshot('example.png')
However, when running the test with nosetests
I get some strange output like follows:
easyprocess: DEBUG: version=0.2.3
pyvirtualdisplay: DEBUG: version=0.2.1
easyprocess: DEBUG: param: "['Xvfb', '-help']"
easyprocess: DEBUG: command: ['Xvfb', '-help']
easyprocess: DEBUG: joined command: Xvfb -help
easyprocess: DEBUG: process was started (pid=21)
easyprocess: DEBUG: process has ended
easyprocess: DEBUG: return code=0
easyprocess: DEBUG: stdout=
easyprocess: DEBUG: stderr=use: X [:<display>] [option]
-a # default pointer acceleration (factor)
-ac disable access control restrictions
-audit int set audit trail level
-auth file select authorization file
-br create root window with black background
+bs enable any backing store support
-bs disable any backing store support
-c turns off key-click
c # key-click volume (0-100)
-cc int default color visual class
-nocursor disable the cursor
-core generate core dump on fatal error
-displayfd fd file descriptor to write display number to when ready to connect
-dpi int screen resolution in dots per inch
-dpms disables VESA DPMS monitor control
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f # bell base (0-100)
-fc string cursor font
-fn string default font name
...
What is this output? Why do I get it and how to 'avoid' it?
Upvotes: 1
Views: 509
Reputation: 11
Reason for this output: In pyvirtualdisplay package below code is there in xauth.py file which checks if easyprocess is installed or not.
def is_installed():
'''
Return whether or not xauth is installed.
'''
try:
easyprocess.EasyProcess(['xauth', '-h']).check_installed()
except easyprocess.EasyProcessCheckInstalledError:
return False
else:
return True
Here -h is used by debug in package which displays the help option for easyprocess and the same is displayed in output. Due to this there will be no issue in your code.
Help is present in debug logger. So if you want to suppress this then just set the logger to INFO level using the below line in your code.
logging.getLogger("easyprocess").setLevel(logging.INFO)
Put the above code before initializing the display(like mentioned below):
logging.getLogger("easyprocess").setLevel(logging.INFO)
self.display = Display(visible=0, size=(1366, 768))
self.display.start()
I hope it will resolve your problem !
Upvotes: 1