mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implement Get Element Attribute WebDriver command
This commit is contained in:
parent
cedaac8dbe
commit
6446cc3db8
4 changed files with 35 additions and 0 deletions
|
@ -203,6 +203,21 @@ pub fn handle_get_name(page: &Rc<Page>,
|
|||
}).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_get_attribute(page: &Rc<Page>,
|
||||
pipeline: PipelineId,
|
||||
node_id: String,
|
||||
name: String,
|
||||
reply: IpcSender<Result<Option<String>, ()>>) {
|
||||
reply.send(match find_node_by_unique_id(&*page, pipeline, node_id) {
|
||||
Some(node) => {
|
||||
Ok(node.downcast::<Element>().unwrap().GetAttribute(DOMString::from(name))
|
||||
.map(String::from))
|
||||
},
|
||||
None => Err(())
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
|
||||
pub fn handle_get_url(page: &Rc<Page>,
|
||||
_pipeline: PipelineId,
|
||||
reply: IpcSender<Url>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue