-
Notifications
You must be signed in to change notification settings - Fork 59
Element Screenshot
WebDriver support element screenshot command as described in http://www.w3.org/TR/webdriver/#take-element-screenshot
If the WebDriver cannot capture the entire element bounding rectangle, then it will scroll as much of the element into the current browser viewport as possible and capture the maximum visible area.
Then the bounding rectangle of the element will be captured regardless of the element being hidden/obscured etc...
If the bounding rectangle is 0 height or width an error will be returned.
The expected behavior is to capture what is displayed by the browser to the user, not the UI of the element as a standalone web element, i.e: transparency, overlays, etc... will be captured.
This sample uses QtWebDriver's Selenium API, but any augmenter that supports TAKES_ELEMENT_SCREENSHOT
does the job.
RemoteWebElement elt = (RemoteWebElement) driver.findElement(By.id("foo"));
elt = (RemoteWebElement) new QtWebkitAugmenter().augment(elt);
File screenshot = ((TakesScreenshot)elt).getScreenshotAs(OutputType.FILE);
Home | Build And Run | Releases | Features
Copyright © 1992-2016 Cisco and/or its affiliates