Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view the "Screenshot: available via screen"?

I have started running Selenium tests via PhantomJS from Python. Whenever a test raises an exception I see a traceback followed by the enigmatic phrase

Screenshot: available via screen

It would be nice to be able to view such screenshots, but I have no idea where they are being saved, nor what program (or other) is intended by screen.

(The only "screen" I am familiar with is the terminal multiplexer, which will not show screenshots)

So - what "screen" are they talking about? How do I use it to view the screenshots?

like image 524
jalanb Avatar asked May 27 '16 10:05

jalanb


1 Answers

Run the program in a try block and when the error occur take the screenshot using save_screenshot

Eg :

driver = webdriver.PhantomJS()
driver.set_window_size(1920,1080)
try:
    driver.get('http://whatsmyuseragent.com/')

except Exception,e:
    driver.save_screenshot('screenshot.png')

driver.close()

This will give you the screenshot during that moment Image will be saved at the working of your script

like image 138
Aby Abraham Avatar answered Sep 28 '22 22:09

Aby Abraham