mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement tag name selector for FindElementFromElement WebDriver command
This commit is contained in:
parent
dec73e4cea
commit
616a81fb27
5 changed files with 54 additions and 16 deletions
|
@ -259,6 +259,26 @@ pub fn handle_find_element_element_css(
|
|||
reply.send(node_id).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_find_element_element_tag_name(
|
||||
documents: &Documents,
|
||||
pipeline: PipelineId,
|
||||
element_id: String,
|
||||
selector: String,
|
||||
reply: IpcSender<Result<Option<String>, ()>>,
|
||||
) {
|
||||
let node_id = find_node_by_unique_id(documents, pipeline, element_id)
|
||||
.ok_or(())
|
||||
.and_then(|node| match node.downcast::<Element>() {
|
||||
Some(elem) => Ok(elem
|
||||
.GetElementsByTagName(DOMString::from(selector))
|
||||
.elements_iter()
|
||||
.next()),
|
||||
None => Err(()),
|
||||
})
|
||||
.map(|node| node.map(|x| x.upcast::<Node>().unique_id()));
|
||||
reply.send(node_id).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_find_element_elements_css(
|
||||
documents: &Documents,
|
||||
pipeline: PipelineId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue