Implement WebElement screenshot in InternetExplorerDriver
In selenium py 2.47.1, I am currently unable to take an element screenshot. I have not tested this i
Python version: 2.7.6 Selenium python verison: 2.47.1 Browsers tested: Chrome, Firefox
Script:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://google.com')
el = driver.find_element_by_class_name('gsfi')
el.screenshot('test.png')
driver.quit()
Stacktrace:
Traceback (most recent call last):
File "/Users/Stephen/Projects/g2m/g2m-free-qa-automation/test.py", line 7, in <module>
el.screenshot('test.png')
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 399, in screenshot
png = self.screenshot_as_png
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 386, in screenshot_as_png
return base64.b64decode(self.screenshot_as_base64.encode('ascii'))
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 376, in screenshot_as_base64
return self._execute(Command.ELEMENT_SCREENSHOT)['value']
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 448, in _execute
return self._parent.execute(command, params)
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 196, in execute
self.error_handler.check_response(response)
File "/Users/Stephen/Projects/envs/qa_repo/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 102, in check_response
value = json.loads(value_json)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
This has not been implemented by any of the drivers in the project yet
— Sent from Mailbox
On Tue, Aug 11, 2015 at 10:50 AM, Stephen Davidson [email protected] wrote:
In selenium py 2.47.1, I am currently unable to take an element screenshot. Python version: 2.7.6 Selenium python verison: 2.47.1 Browsers tested: Chrome, Firefox Script:
from selenium import webdriver driver = webdriver.Chrome() driver.get('https://google.com') el = driver.find_element_by_class_name('gsfi') el.screenshot('test.png') driver.quit()
Reply to this email directly or view it on GitHub: https://github.com/SeleniumHQ/selenium/issues/912
I assumed that this feature had been implemented back in 2.46 based off of the changelog https://github.com/SeleniumHQ/selenium/blob/master/py/CHANGES#L15
Looking at the changelog @lukeis added support for this in the python client (which makes the changelog correct (kinda)). I only know of one implementation, which is in "alpha" stage with this.
You can see about it in http://www.theautomatedtester.co.uk/blog/2015/another-marionette-release-now-with-windows-support.html and https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver .
Leaving this bug open as we may repurpose to add support for element screenshot to things.
David Burns Email: [email protected] URL: http://www.theautomatedtester.co.uk/
On Tue, Aug 11, 2015 at 2:41 PM, Stephen Davidson [email protected] wrote:
I assumed that this feature had been implemented back in 2.46 based off of the changelog https://github.com/SeleniumHQ/selenium/blob/master/py/CHANGES#L15
— Reply to this email directly or view it on GitHub https://github.com/SeleniumHQ/selenium/issues/912#issuecomment-129877145 .
@AutomatedTester there's one other that implements it. EdgeDriver.
essentially this bug should only be left open as to intend to implement it in our open source FirefoxDriver, InternetExplorerDriver and (maybe) SafariDriver
@StephenDavidson if you would like this availabe in chromedriver, please log a bug with that project: https://code.google.com/p/chromedriver/issues/list
Since this feature is only available in one actually used driver, and not even in the reference driver, don't you think this should be explicitly stated on at least the pydoc for this feature? This issue is pretty much the only place you can currently find that only the Edge Driver supports it...
This is in Marionette, the FirefoxDriver replacement and has been since we added the screenshot code nearly 2 years ago.
With the release of Safari 10, Apple now offers official support WebDriver. Because of this, the Selenium project no supports the legacy implementation from 2.x.
Users are advised to switch to Apple’s driver and file bugs at https://bugreport.apple.com/
Is this feature going to be implemented any time soon?
Firefox allows that, but Chrome does not support element.screenshot() method right now. Is it going to be implemented?
Thank you for bringing this issue up. Time to close it because element screenshots have been implemented in IE too.
For Chrome follow chromedriver issue tracker: https://bugs.chromium.org/p/chromedriver/issues/list
Thank you for bringing this issue up. Time to close it because element screenshots have been implemented in IE too.
For Chrome follow chromedriver issue tracker: https://bugs.chromium.org/p/chromedriver/issues/list
can i get some tips? How to take a element screenshot in IE?