Created
September 25, 2012 15:58
-
-
Save DazWorrall/3782753 to your computer and use it in GitHub Desktop.
Taking a screenshot using selenium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connecting | |
Traceback (most recent call last): | |
File "screenshot.py", line 16, in <module> | |
desired_capabilities=desired_capabilities, | |
File "/Users/daz/.virtualenvs/1a5c5f7263517393/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 63, in __init__ | |
self.start_session(desired_capabilities, browser_profile) | |
File "/Users/daz/.virtualenvs/1a5c5f7263517393/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 105, in start_session | |
'desiredCapabilities': desired_capabilities, | |
File "/Users/daz/.virtualenvs/1a5c5f7263517393/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in execute | |
self.error_handler.check_response(response) | |
File "/Users/daz/.virtualenvs/1a5c5f7263517393/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 125, in check_response | |
raise exception_class(value) | |
selenium.common.exceptions.WebDriverException: Message: 'The requested combination of browser, version and OS is currently unsupported in this version of Selenium (Webdriver): "safari " on "Mac 10.6"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from selenium import webdriver | |
import sys | |
url = sys.argv[1] # http://<user>:<apikey>@ondemand.saucelabs.com:80/wd/hub | |
desired_capabilities={ | |
'browserName': 'safari', | |
'javascriptEnabled': True, | |
'platform': 'MAC', | |
'max-duration': 90, | |
} | |
print 'Connecting' | |
driver = webdriver.Remote( | |
command_executor=url, | |
desired_capabilities=desired_capabilities, | |
) | |
print 'Navigating' | |
driver.get('http://www.google.com') | |
print 'Taking screenshot' | |
driver.get_screenshot_as_base64() | |
print 'Quitting' | |
driver.quit() | |
print 'Done.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connecting | |
Navigating | |
Taking screenshot | |
Traceback (most recent call last): | |
File "./test.py", line 21, in <module> | |
driver.get_screenshot_as_base64() | |
File "/Users/daz/.virtualenvs/1368fa811d6ec01d/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 720, in get_screenshot_as_base64 | |
return self.execute(Command.SCREENSHOT)['value'] | |
File "/Users/daz/.virtualenvs/1368fa811d6ec01d/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in execute | |
self.error_handler.check_response(response) | |
File "/Users/daz/.virtualenvs/1368fa811d6ec01d/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 147, in check_response | |
raise exception_class(message, screen, stacktrace) | |
selenium.common.exceptions.WebDriverException: Message: u'ERROR Selenium Server in Sauce Labs was already shut down' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment