mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement tag name selector for FindElement WebDriver command
This commit is contained in:
parent
4128a38936
commit
7d5b324bda
5 changed files with 45 additions and 15 deletions
|
@ -182,6 +182,25 @@ pub fn handle_find_element_css(
|
|||
reply.send(node_id).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_find_element_tag_name(
|
||||
documents: &Documents,
|
||||
pipeline: PipelineId,
|
||||
selector: String,
|
||||
reply: IpcSender<Result<Option<String>, ()>>,
|
||||
) {
|
||||
let node_id = documents
|
||||
.find_document(pipeline)
|
||||
.ok_or(())
|
||||
.and_then(|doc| {
|
||||
Ok(doc
|
||||
.GetElementsByTagName(DOMString::from(selector))
|
||||
.elements_iter()
|
||||
.next())
|
||||
})
|
||||
.map(|node| node.map(|x| x.upcast::<Node>().unique_id()));
|
||||
reply.send(node_id).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_find_elements_css(
|
||||
documents: &Documents,
|
||||
pipeline: PipelineId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue