mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Add WebDriver support for getting elements by selector.
Also adds example support for getting the name and text properties of the elements.
This commit is contained in:
parent
892a740426
commit
9e44206760
5 changed files with 163 additions and 10 deletions
|
@ -975,20 +975,17 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
|
|||
|
||||
fn get_unique_id(self) -> String {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
if self.unique_id.borrow().is_empty() {
|
||||
let mut unique_id = self.unique_id.borrow_mut();
|
||||
*unique_id = uuid::Uuid::new_v4().to_simple_string();
|
||||
}
|
||||
let id = self.unique_id.borrow();
|
||||
id.clone()
|
||||
}
|
||||
|
||||
fn summarize(self) -> NodeInfo {
|
||||
if self.unique_id.borrow().is_empty() {
|
||||
let mut unique_id = self.unique_id.borrow_mut();
|
||||
*unique_id = uuid::Uuid::new_v4().to_simple_string();
|
||||
}
|
||||
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let unique_id = self.unique_id.borrow();
|
||||
NodeInfo {
|
||||
uniqueId: unique_id.clone(),
|
||||
uniqueId: self.get_unique_id(),
|
||||
baseURI: self.GetBaseURI().unwrap_or("".to_owned()),
|
||||
parent: self.GetParentNode().root().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
|
||||
nodeType: self.NodeType(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue