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:
James Graham 2015-05-06 22:35:22 +01:00
parent 892a740426
commit 9e44206760
5 changed files with 163 additions and 10 deletions

View file

@ -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(),