Add support for returning array-like types from the Execute(Async)Script wd command

This commit is contained in:
George Roman 2019-07-03 22:53:40 +03:00
parent b3c0ed295f
commit 58f80f4ff3
22 changed files with 88 additions and 187 deletions

View file

@ -224,6 +224,12 @@ impl Serialize for SendableWebDriverJSValue {
WebDriverJSValue::Boolean(x) => serializer.serialize_bool(x),
WebDriverJSValue::Number(x) => serializer.serialize_f64(x),
WebDriverJSValue::String(ref x) => serializer.serialize_str(&x),
WebDriverJSValue::Element(ref x) => x.serialize(serializer),
WebDriverJSValue::ArrayLike(ref x) => x
.iter()
.map(|element| SendableWebDriverJSValue(element.clone()))
.collect::<Vec<SendableWebDriverJSValue>>()
.serialize(serializer),
}
}
}
@ -1397,6 +1403,10 @@ impl Handler {
ErrorStatus::UnsupportedOperation,
"Unsupported return type",
)),
Err(WebDriverJSError::JSError) => Err(WebDriverError::new(
ErrorStatus::JavascriptError,
"JS evaluation raised an exception",
)),
Err(WebDriverJSError::BrowsingContextNotFound) => Err(WebDriverError::new(
ErrorStatus::JavascriptError,
"Pipeline id not found in browsing context",