mirror of
https://github.com/servo/servo.git
synced 2025-06-26 01:54:33 +01:00
[WebDriver] Implement "Find Element(s) From ShadowRoot" (#37578)
Also renamed all "CSS" selector variants of `WebDriverScriptCommand` to avoid confusion. Testing: Mostly `./mach test-wpt -r tests\wpt\tests\webdriver\tests\classic\find_*_from_shadow_root\find.py --product servodriver` But many other test also relies on finding element(s) from shadow root, so I ran the entire test. All deleted lines are from test expectations. --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
c9d503c458
commit
ce4da2bf97
17 changed files with 237 additions and 315 deletions
|
@ -2276,8 +2276,8 @@ impl ScriptThread {
|
||||||
WebDriverScriptCommand::DeleteCookie(name, reply) => {
|
WebDriverScriptCommand::DeleteCookie(name, reply) => {
|
||||||
webdriver_handlers::handle_delete_cookie(&documents, pipeline_id, name, reply)
|
webdriver_handlers::handle_delete_cookie(&documents, pipeline_id, name, reply)
|
||||||
},
|
},
|
||||||
WebDriverScriptCommand::FindElementCSS(selector, reply) => {
|
WebDriverScriptCommand::FindElementCSSSelector(selector, reply) => {
|
||||||
webdriver_handlers::handle_find_element_css(
|
webdriver_handlers::handle_find_element_css_selector(
|
||||||
&documents,
|
&documents,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
selector,
|
selector,
|
||||||
|
@ -2303,8 +2303,8 @@ impl ScriptThread {
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
WebDriverScriptCommand::FindElementsCSS(selector, reply) => {
|
WebDriverScriptCommand::FindElementsCSSSelector(selector, reply) => {
|
||||||
webdriver_handlers::handle_find_elements_css(
|
webdriver_handlers::handle_find_elements_css_selector(
|
||||||
&documents,
|
&documents,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
selector,
|
selector,
|
||||||
|
@ -2330,8 +2330,8 @@ impl ScriptThread {
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
WebDriverScriptCommand::FindElementElementCSS(selector, element_id, reply) => {
|
WebDriverScriptCommand::FindElementElementCSSSelector(selector, element_id, reply) => {
|
||||||
webdriver_handlers::handle_find_element_element_css(
|
webdriver_handlers::handle_find_element_element_css_selector(
|
||||||
&documents,
|
&documents,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
element_id,
|
element_id,
|
||||||
|
@ -2363,8 +2363,8 @@ impl ScriptThread {
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
WebDriverScriptCommand::FindElementElementsCSS(selector, element_id, reply) => {
|
WebDriverScriptCommand::FindElementElementsCSSSelector(selector, element_id, reply) => {
|
||||||
webdriver_handlers::handle_find_element_elements_css(
|
webdriver_handlers::handle_find_element_elements_css_selector(
|
||||||
&documents,
|
&documents,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
element_id,
|
element_id,
|
||||||
|
@ -2396,6 +2396,40 @@ impl ScriptThread {
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
WebDriverScriptCommand::FindShadowElementsCSSSelector(
|
||||||
|
selector,
|
||||||
|
shadow_root_id,
|
||||||
|
reply,
|
||||||
|
) => webdriver_handlers::handle_find_shadow_elements_css_selector(
|
||||||
|
&documents,
|
||||||
|
pipeline_id,
|
||||||
|
shadow_root_id,
|
||||||
|
selector,
|
||||||
|
reply,
|
||||||
|
),
|
||||||
|
WebDriverScriptCommand::FindShadowElementsLinkText(
|
||||||
|
selector,
|
||||||
|
shadow_root_id,
|
||||||
|
partial,
|
||||||
|
reply,
|
||||||
|
) => webdriver_handlers::handle_find_shadow_elements_link_text(
|
||||||
|
&documents,
|
||||||
|
pipeline_id,
|
||||||
|
shadow_root_id,
|
||||||
|
selector,
|
||||||
|
partial,
|
||||||
|
reply,
|
||||||
|
can_gc,
|
||||||
|
),
|
||||||
|
WebDriverScriptCommand::FindShadowElementsTagName(selector, shadow_root_id, reply) => {
|
||||||
|
webdriver_handlers::handle_find_shadow_elements_tag_name(
|
||||||
|
&documents,
|
||||||
|
pipeline_id,
|
||||||
|
shadow_root_id,
|
||||||
|
selector,
|
||||||
|
reply,
|
||||||
|
)
|
||||||
|
},
|
||||||
WebDriverScriptCommand::GetElementShadowRoot(element_id, reply) => {
|
WebDriverScriptCommand::GetElementShadowRoot(element_id, reply) => {
|
||||||
webdriver_handlers::handle_get_element_shadow_root(
|
webdriver_handlers::handle_get_element_shadow_root(
|
||||||
&documents,
|
&documents,
|
||||||
|
|
|
@ -79,7 +79,6 @@ fn is_stale(element: &Element) -> bool {
|
||||||
!element.owner_document().is_active() || !element.is_connected()
|
!element.owner_document().is_active() || !element.is_connected()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
/// <https://w3c.github.io/webdriver/#dfn-get-a-known-shadow-root>
|
/// <https://w3c.github.io/webdriver/#dfn-get-a-known-shadow-root>
|
||||||
fn get_known_shadow_root(
|
fn get_known_shadow_root(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
|
@ -689,7 +688,7 @@ fn retrieve_document_and_check_root_existence(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_find_element_css(
|
pub(crate) fn handle_find_element_css_selector(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
pipeline: PipelineId,
|
pipeline: PipelineId,
|
||||||
selector: String,
|
selector: String,
|
||||||
|
@ -748,7 +747,7 @@ pub(crate) fn handle_find_element_tag_name(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_find_elements_css(
|
pub(crate) fn handle_find_elements_css_selector(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
pipeline: PipelineId,
|
pipeline: PipelineId,
|
||||||
selector: String,
|
selector: String,
|
||||||
|
@ -812,7 +811,7 @@ pub(crate) fn handle_find_elements_tag_name(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_find_element_element_css(
|
pub(crate) fn handle_find_element_element_css_selector(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
pipeline: PipelineId,
|
pipeline: PipelineId,
|
||||||
element_id: String,
|
element_id: String,
|
||||||
|
@ -871,7 +870,7 @@ pub(crate) fn handle_find_element_element_tag_name(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_find_element_elements_css(
|
pub(crate) fn handle_find_element_elements_css_selector(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
pipeline: PipelineId,
|
pipeline: PipelineId,
|
||||||
element_id: String,
|
element_id: String,
|
||||||
|
@ -935,6 +934,85 @@ pub(crate) fn handle_find_element_elements_tag_name(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <https://w3c.github.io/webdriver/#find-elements-from-shadow-root>
|
||||||
|
pub(crate) fn handle_find_shadow_elements_css_selector(
|
||||||
|
documents: &DocumentCollection,
|
||||||
|
pipeline: PipelineId,
|
||||||
|
shadow_root_id: String,
|
||||||
|
selector: String,
|
||||||
|
reply: IpcSender<Result<Vec<String>, ErrorStatus>>,
|
||||||
|
) {
|
||||||
|
reply
|
||||||
|
.send(
|
||||||
|
get_known_shadow_root(documents, pipeline, shadow_root_id).and_then(|shadow_root| {
|
||||||
|
shadow_root
|
||||||
|
.upcast::<Node>()
|
||||||
|
.query_selector_all(DOMString::from(selector))
|
||||||
|
.map_err(|_| ErrorStatus::InvalidSelector)
|
||||||
|
.map(|nodes| {
|
||||||
|
nodes
|
||||||
|
.iter()
|
||||||
|
.map(|x| x.upcast::<Node>().unique_id(pipeline))
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn handle_find_shadow_elements_link_text(
|
||||||
|
documents: &DocumentCollection,
|
||||||
|
pipeline: PipelineId,
|
||||||
|
shadow_root_id: String,
|
||||||
|
selector: String,
|
||||||
|
partial: bool,
|
||||||
|
reply: IpcSender<Result<Vec<String>, ErrorStatus>>,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) {
|
||||||
|
reply
|
||||||
|
.send(
|
||||||
|
get_known_shadow_root(documents, pipeline, shadow_root_id).and_then(|shadow_root| {
|
||||||
|
all_matching_links(
|
||||||
|
shadow_root.upcast::<Node>(),
|
||||||
|
selector.clone(),
|
||||||
|
partial,
|
||||||
|
can_gc,
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn handle_find_shadow_elements_tag_name(
|
||||||
|
documents: &DocumentCollection,
|
||||||
|
pipeline: PipelineId,
|
||||||
|
shadow_root_id: String,
|
||||||
|
selector: String,
|
||||||
|
reply: IpcSender<Result<Vec<String>, ErrorStatus>>,
|
||||||
|
) {
|
||||||
|
// According to spec, we should use `getElementsByTagName`. But it is wrong, as only
|
||||||
|
// Document and Element implement this method. So we use `querySelectorAll` instead.
|
||||||
|
// But we should not return InvalidSelector error if the selector is not valid,
|
||||||
|
// as `getElementsByTagName` won't.
|
||||||
|
// See https://github.com/w3c/webdriver/issues/1903
|
||||||
|
reply
|
||||||
|
.send(
|
||||||
|
get_known_shadow_root(documents, pipeline, shadow_root_id).map(|shadow_root| {
|
||||||
|
shadow_root
|
||||||
|
.upcast::<Node>()
|
||||||
|
.query_selector_all(DOMString::from(selector))
|
||||||
|
.map(|nodes| {
|
||||||
|
nodes
|
||||||
|
.iter()
|
||||||
|
.map(|x| x.upcast::<Node>().unique_id(pipeline))
|
||||||
|
.collect()
|
||||||
|
})
|
||||||
|
.unwrap_or_default()
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
/// <https://www.w3.org/TR/webdriver2/#dfn-get-element-shadow-root>
|
/// <https://www.w3.org/TR/webdriver2/#dfn-get-element-shadow-root>
|
||||||
pub(crate) fn handle_get_element_shadow_root(
|
pub(crate) fn handle_get_element_shadow_root(
|
||||||
documents: &DocumentCollection,
|
documents: &DocumentCollection,
|
||||||
|
|
|
@ -123,13 +123,13 @@ pub enum WebDriverScriptCommand {
|
||||||
DeleteCookie(String, IpcSender<Result<(), ErrorStatus>>),
|
DeleteCookie(String, IpcSender<Result<(), ErrorStatus>>),
|
||||||
ExecuteScript(String, IpcSender<WebDriverJSResult>),
|
ExecuteScript(String, IpcSender<WebDriverJSResult>),
|
||||||
ExecuteAsyncScript(String, IpcSender<WebDriverJSResult>),
|
ExecuteAsyncScript(String, IpcSender<WebDriverJSResult>),
|
||||||
FindElementCSS(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
FindElementCSSSelector(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
||||||
FindElementLinkText(String, bool, IpcSender<Result<Option<String>, ErrorStatus>>),
|
FindElementLinkText(String, bool, IpcSender<Result<Option<String>, ErrorStatus>>),
|
||||||
FindElementTagName(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
FindElementTagName(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
||||||
FindElementsCSS(String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
FindElementsCSSSelector(String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
FindElementsLinkText(String, bool, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
FindElementsLinkText(String, bool, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
FindElementsTagName(String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
FindElementsTagName(String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
FindElementElementCSS(
|
FindElementElementCSSSelector(
|
||||||
String,
|
String,
|
||||||
String,
|
String,
|
||||||
IpcSender<Result<Option<String>, ErrorStatus>>,
|
IpcSender<Result<Option<String>, ErrorStatus>>,
|
||||||
|
@ -145,7 +145,7 @@ pub enum WebDriverScriptCommand {
|
||||||
String,
|
String,
|
||||||
IpcSender<Result<Option<String>, ErrorStatus>>,
|
IpcSender<Result<Option<String>, ErrorStatus>>,
|
||||||
),
|
),
|
||||||
FindElementElementsCSS(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
FindElementElementsCSSSelector(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
FindElementElementsLinkText(
|
FindElementElementsLinkText(
|
||||||
String,
|
String,
|
||||||
String,
|
String,
|
||||||
|
@ -153,6 +153,14 @@ pub enum WebDriverScriptCommand {
|
||||||
IpcSender<Result<Vec<String>, ErrorStatus>>,
|
IpcSender<Result<Vec<String>, ErrorStatus>>,
|
||||||
),
|
),
|
||||||
FindElementElementsTagName(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
FindElementElementsTagName(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
|
FindShadowElementsCSSSelector(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
|
FindShadowElementsLinkText(
|
||||||
|
String,
|
||||||
|
String,
|
||||||
|
bool,
|
||||||
|
IpcSender<Result<Vec<String>, ErrorStatus>>,
|
||||||
|
),
|
||||||
|
FindShadowElementsTagName(String, String, IpcSender<Result<Vec<String>, ErrorStatus>>),
|
||||||
GetElementShadowRoot(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
GetElementShadowRoot(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
||||||
ElementClick(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
ElementClick(String, IpcSender<Result<Option<String>, ErrorStatus>>),
|
||||||
GetActiveElement(IpcSender<Option<String>>),
|
GetActiveElement(IpcSender<Option<String>>),
|
||||||
|
|
|
@ -989,7 +989,10 @@ impl Handler {
|
||||||
|
|
||||||
match parameters.using {
|
match parameters.using {
|
||||||
LocatorStrategy::CSSSelector => {
|
LocatorStrategy::CSSSelector => {
|
||||||
let cmd = WebDriverScriptCommand::FindElementCSS(parameters.value.clone(), sender);
|
let cmd = WebDriverScriptCommand::FindElementCSSSelector(
|
||||||
|
parameters.value.clone(),
|
||||||
|
sender,
|
||||||
|
);
|
||||||
self.browsing_context_script_command(cmd)?;
|
self.browsing_context_script_command(cmd)?;
|
||||||
},
|
},
|
||||||
LocatorStrategy::LinkText | LocatorStrategy::PartialLinkText => {
|
LocatorStrategy::LinkText | LocatorStrategy::PartialLinkText => {
|
||||||
|
@ -1187,7 +1190,10 @@ impl Handler {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
match parameters.using {
|
match parameters.using {
|
||||||
LocatorStrategy::CSSSelector => {
|
LocatorStrategy::CSSSelector => {
|
||||||
let cmd = WebDriverScriptCommand::FindElementsCSS(parameters.value.clone(), sender);
|
let cmd = WebDriverScriptCommand::FindElementsCSSSelector(
|
||||||
|
parameters.value.clone(),
|
||||||
|
sender,
|
||||||
|
);
|
||||||
self.browsing_context_script_command(cmd)?;
|
self.browsing_context_script_command(cmd)?;
|
||||||
},
|
},
|
||||||
LocatorStrategy::LinkText | LocatorStrategy::PartialLinkText => {
|
LocatorStrategy::LinkText | LocatorStrategy::PartialLinkText => {
|
||||||
|
@ -1236,7 +1242,7 @@ impl Handler {
|
||||||
|
|
||||||
match parameters.using {
|
match parameters.using {
|
||||||
LocatorStrategy::CSSSelector => {
|
LocatorStrategy::CSSSelector => {
|
||||||
let cmd = WebDriverScriptCommand::FindElementElementCSS(
|
let cmd = WebDriverScriptCommand::FindElementElementCSSSelector(
|
||||||
parameters.value.clone(),
|
parameters.value.clone(),
|
||||||
element.to_string(),
|
element.to_string(),
|
||||||
sender,
|
sender,
|
||||||
|
@ -1295,7 +1301,7 @@ impl Handler {
|
||||||
|
|
||||||
match parameters.using {
|
match parameters.using {
|
||||||
LocatorStrategy::CSSSelector => {
|
LocatorStrategy::CSSSelector => {
|
||||||
let cmd = WebDriverScriptCommand::FindElementElementsCSS(
|
let cmd = WebDriverScriptCommand::FindElementElementsCSSSelector(
|
||||||
parameters.value.clone(),
|
parameters.value.clone(),
|
||||||
element.to_string(),
|
element.to_string(),
|
||||||
sender,
|
sender,
|
||||||
|
@ -1341,6 +1347,90 @@ impl Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <https://w3c.github.io/webdriver/#find-elements-from-shadow-root>
|
||||||
|
fn handle_find_elements_from_shadow_root(
|
||||||
|
&self,
|
||||||
|
shadow_root: &ShadowRoot,
|
||||||
|
parameters: &LocatorParameters,
|
||||||
|
) -> WebDriverResult<WebDriverResponse> {
|
||||||
|
// Step 4. If selector is undefined, return error with error code invalid argument.
|
||||||
|
if parameters.value.is_empty() {
|
||||||
|
return Err(WebDriverError::new(ErrorStatus::InvalidArgument, ""));
|
||||||
|
}
|
||||||
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
match parameters.using {
|
||||||
|
LocatorStrategy::CSSSelector => {
|
||||||
|
let cmd = WebDriverScriptCommand::FindShadowElementsCSSSelector(
|
||||||
|
parameters.value.clone(),
|
||||||
|
shadow_root.to_string(),
|
||||||
|
sender,
|
||||||
|
);
|
||||||
|
self.browsing_context_script_command(cmd)?;
|
||||||
|
},
|
||||||
|
LocatorStrategy::LinkText | LocatorStrategy::PartialLinkText => {
|
||||||
|
let cmd = WebDriverScriptCommand::FindShadowElementsLinkText(
|
||||||
|
parameters.value.clone(),
|
||||||
|
shadow_root.to_string(),
|
||||||
|
parameters.using == LocatorStrategy::PartialLinkText,
|
||||||
|
sender,
|
||||||
|
);
|
||||||
|
self.browsing_context_script_command(cmd)?;
|
||||||
|
},
|
||||||
|
LocatorStrategy::TagName => {
|
||||||
|
let cmd = WebDriverScriptCommand::FindShadowElementsTagName(
|
||||||
|
parameters.value.clone(),
|
||||||
|
shadow_root.to_string(),
|
||||||
|
sender,
|
||||||
|
);
|
||||||
|
self.browsing_context_script_command(cmd)?;
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
return Err(WebDriverError::new(
|
||||||
|
ErrorStatus::UnsupportedOperation,
|
||||||
|
"Unsupported locator strategy",
|
||||||
|
));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
match wait_for_script_response(receiver)? {
|
||||||
|
Ok(value) => {
|
||||||
|
let resp_value: Vec<Value> = value
|
||||||
|
.into_iter()
|
||||||
|
.map(|x| serde_json::to_value(WebElement(x)).unwrap())
|
||||||
|
.collect();
|
||||||
|
Ok(WebDriverResponse::Generic(ValueResponse(
|
||||||
|
serde_json::to_value(resp_value)?,
|
||||||
|
)))
|
||||||
|
},
|
||||||
|
Err(error) => Err(WebDriverError::new(error, "")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://w3c.github.io/webdriver/#find-element-from-shadow-root>
|
||||||
|
fn handle_find_element_from_shadow_root(
|
||||||
|
&self,
|
||||||
|
shadow_root: &ShadowRoot,
|
||||||
|
parameters: &LocatorParameters,
|
||||||
|
) -> WebDriverResult<WebDriverResponse> {
|
||||||
|
let res = self.handle_find_elements_from_shadow_root(shadow_root, parameters)?;
|
||||||
|
// Step 9. If result is empty, return error with error code no such element.
|
||||||
|
// Otherwise, return the first element of result.
|
||||||
|
if let WebDriverResponse::Generic(ValueResponse(values)) = res {
|
||||||
|
let arr = values.as_array().unwrap();
|
||||||
|
if let Some(first) = arr.first() {
|
||||||
|
Ok(WebDriverResponse::Generic(ValueResponse(first.clone())))
|
||||||
|
} else {
|
||||||
|
Err(WebDriverError::new(ErrorStatus::NoSuchElement, ""))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Err(WebDriverError::new(
|
||||||
|
ErrorStatus::UnknownError,
|
||||||
|
"Unexpected response",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_get_shadow_root(&self, element: WebElement) -> WebDriverResult<WebDriverResponse> {
|
fn handle_get_shadow_root(&self, element: WebElement) -> WebDriverResult<WebDriverResponse> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
let cmd = WebDriverScriptCommand::GetElementShadowRoot(element.to_string(), sender);
|
let cmd = WebDriverScriptCommand::GetElementShadowRoot(element.to_string(), sender);
|
||||||
|
@ -2164,6 +2254,12 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
|
||||||
WebDriverCommand::FindElementElements(ref element, ref parameters) => {
|
WebDriverCommand::FindElementElements(ref element, ref parameters) => {
|
||||||
self.handle_find_elements_from_element(element, parameters)
|
self.handle_find_elements_from_element(element, parameters)
|
||||||
},
|
},
|
||||||
|
WebDriverCommand::FindShadowRootElements(ref shadow_root, ref parameters) => {
|
||||||
|
self.handle_find_elements_from_shadow_root(shadow_root, parameters)
|
||||||
|
},
|
||||||
|
WebDriverCommand::FindShadowRootElement(ref shadow_root, ref parameters) => {
|
||||||
|
self.handle_find_element_from_shadow_root(shadow_root, parameters)
|
||||||
|
},
|
||||||
WebDriverCommand::GetShadowRoot(element) => self.handle_get_shadow_root(element),
|
WebDriverCommand::GetShadowRoot(element) => self.handle_get_shadow_root(element),
|
||||||
WebDriverCommand::GetNamedCookie(name) => self.handle_get_cookie(name),
|
WebDriverCommand::GetNamedCookie(name) => self.handle_get_cookie(name),
|
||||||
WebDriverCommand::GetCookies => self.handle_get_cookies(),
|
WebDriverCommand::GetCookies => self.handle_get_cookies(),
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
[click.py]
|
[click.py]
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,97 +1,10 @@
|
||||||
[find.py]
|
[find.py]
|
||||||
[test_null_parameter_value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_top_browsing_context]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_element]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_unknown_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_shadow_root_from_other_window_handle]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
|
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_detached_shadow_root[top_context\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_detached_shadow_root[child_context\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_element_with_unknown_selector[not-existent\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_element_with_unknown_selector[existent-other-frame\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_element_with_unknown_selector[existent-outside-shadow-root\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[True\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[shadow_root_id3\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[shadow_root_id4\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[a\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[True\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[using4\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[using5\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[value1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[value2\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_found_element_equivalence]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element[open-css selector-#linkText\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element[open-link text-full link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element[open-partial link text-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element[open-tag name-a\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element[open-xpath-//a\]]
|
[test_find_element[open-xpath-//a\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -110,47 +23,5 @@
|
||||||
[test_find_element[closed-xpath-//a\]]
|
[test_find_element[closed-xpath-//a\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=#>link text</a>-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=#> link text </a>-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=#>link<br>text</a>-link\\ntext\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=#>link&text</a>-link&text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=#>LINK TEXT</a>-LINK TEXT\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_link_text[<a href=# style='text-transform: uppercase'>link text</a>-LINK TEXT\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#>partial link text</a>-link\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#> partial link text </a>-link\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#>partial link text</a>-k t\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#>partial link<br>text</a>-k\\nt\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#>partial link&text</a>-k&t\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=#>PARTIAL LINK TEXT</a>-LINK\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_partial_link_text[<a href=# style='text-transform: uppercase'>partial link text</a>-LINK\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_in_nested_shadow_root[open\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_element_in_nested_shadow_root[closed\]]
|
[test_find_element_in_nested_shadow_root[closed\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -1,97 +1,10 @@
|
||||||
[find.py]
|
[find.py]
|
||||||
[test_null_parameter_value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_top_browsing_context]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_element]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_unknown_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_shadow_root_from_other_window_handle]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
|
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_detached_shadow_root[top_context\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_detached_shadow_root[child_context\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_elements_with_unknown_selector[not-existent\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_elements_with_unknown_selector[existent-other-frame\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_no_elements_with_unknown_selector[existent-outside-shadow-root\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[True\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[shadow_root_id3\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_shadow_root_id_argument[shadow_root_id4\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[a\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[True\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[using4\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_using_argument[using5\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[None\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[value1\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_invalid_selector_argument[value2\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_equivalence]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements[open-css selector-#linkText\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements[open-link text-full link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements[open-partial link text-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements[open-tag name-a\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements[open-xpath-//a\]]
|
[test_find_elements[open-xpath-//a\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -110,47 +23,5 @@
|
||||||
[test_find_elements[closed-xpath-//a\]]
|
[test_find_elements[closed-xpath-//a\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=#>link text</a>-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=#> link text </a>-link text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=#>link<br>text</a>-link\\ntext\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=#>link&text</a>-link&text\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=#>LINK TEXT</a>-LINK TEXT\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_link_text[<a href=# style='text-transform: uppercase'>link text</a>-LINK TEXT\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#>partial link text</a>-link\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#> partial link text </a>-link\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#>partial link text</a>-k t\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#>partial link<br>text</a>-k\\nt\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#>partial link&text</a>-k&t\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=#>PARTIAL LINK TEXT</a>-LINK\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_partial_link_text[<a href=# style='text-transform: uppercase'>partial link text</a>-LINK\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_in_nested_shadow_root[open\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_find_elements_in_nested_shadow_root[closed\]]
|
[test_find_elements_in_nested_shadow_root[closed\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_computed_roles[<article>foo</article>-article-article\]]
|
[test_computed_roles[<article>foo</article>-article-article\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_boolean_attribute[audio-attrs0\]]
|
[test_boolean_attribute[audio-attrs0\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
[get.py]
|
[get.py]
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_web_reference[shadowRoot-ShadowRoot\]]
|
[test_web_reference[shadowRoot-ShadowRoot\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_basic]
|
[test_basic]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_get_element_tag_name]
|
[test_get_element_tag_name]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_shadow_root_slot[custom outside\]]
|
[test_shadow_root_slot[custom outside\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_stale_element_reference[child_context\]]
|
[test_stale_element_reference[child_context\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,5 @@
|
||||||
[test_no_browsing_context]
|
[test_no_browsing_context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_no_such_element_with_shadow_root]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_stale_element_reference[child_context\]]
|
[test_stale_element_reference[child_context\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
[wheel.py]
|
[wheel.py]
|
||||||
[test_scroll_shadow_tree[outer-open\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_scroll_shadow_tree[outer-closed\]]
|
[test_scroll_shadow_tree[outer-closed\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_scroll_shadow_tree[inner-open\]]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[test_scroll_shadow_tree[inner-closed\]]
|
[test_scroll_shadow_tree[inner-closed\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue