зеркало из https://github.com/mozilla/gecko-dev.git
geckodriver: Adds TakesElementScreenshot
This is already available in Marionette. This allows us to call Marionette from Selenium to take screenshots of elements. Source-Repo: https://github.com/mozilla/geckodriver Source-Revision: cb67c0aa66e3d50223de8e79eb4e1333bfb09401 committer: jgraham <james@hoppipolla.co.uk> --HG-- extra : rebase_source : b73deed5b7ea1b4de94a402453b5427f96510204
This commit is contained in:
Родитель
25bdc483b2
Коммит
3f8cd98a99
|
@ -33,8 +33,8 @@ use webdriver::command::WebDriverCommand::{
|
|||
ElementClick, ElementTap, ElementClear, ElementSendKeys,
|
||||
ExecuteScript, ExecuteAsyncScript, GetCookies, GetCookie, AddCookie,
|
||||
DeleteCookies, DeleteCookie, SetTimeouts, DismissAlert,
|
||||
AcceptAlert, GetAlertText, SendAlertText, TakeScreenshot, Extension,
|
||||
SetWindowPosition, GetWindowPosition};
|
||||
AcceptAlert, GetAlertText, SendAlertText, TakeScreenshot, TakeElementScreenshot,
|
||||
Extension, SetWindowPosition, GetWindowPosition};
|
||||
use webdriver::command::{
|
||||
NewSessionParameters, GetParameters, WindowSizeParameters, SwitchToWindowParameters,
|
||||
SwitchToFrameParameters, LocatorParameters, JavascriptCommandParameters,
|
||||
|
@ -568,7 +568,7 @@ impl MarionetteSession {
|
|||
IsSelected(_) | GetElementAttribute(_, _) | GetElementProperty(_, _) |
|
||||
GetCSSValue(_, _) | GetElementText(_) |
|
||||
GetElementTagName(_) | IsEnabled(_) | ExecuteScript(_) | ExecuteAsyncScript(_) |
|
||||
GetAlertText | TakeScreenshot => {
|
||||
GetAlertText | TakeScreenshot | TakeElementScreenshot(_) => {
|
||||
let value = try_opt!(resp.result.find("value"),
|
||||
ErrorStatus::UnknownError,
|
||||
"Failed to find value field");
|
||||
|
@ -934,6 +934,13 @@ impl MarionetteCommand {
|
|||
data.insert("full".to_string(), Json::Boolean(false));
|
||||
(Some("takeScreenshot"), Some(Ok(data)))
|
||||
},
|
||||
TakeElementScreenshot(ref e) => {
|
||||
let mut data = BTreeMap::new();
|
||||
data.insert("id".to_string(), e.id.to_json());
|
||||
data.insert("highlights".to_string(), Json::Array(vec![]));
|
||||
data.insert("full".to_string(), Json::Boolean(false));
|
||||
(Some("takeScreenshot"), Some(Ok(data)))
|
||||
},
|
||||
Extension(ref extension) => {
|
||||
match extension {
|
||||
&GeckoExtensionCommand::GetContext => (Some("getContext"), None),
|
||||
|
|
Загрузка…
Ссылка в новой задаче