mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
[WebDriver] Implement XPath Locator Strategy (#37783)
1. Implement XPath Locator Strategy 2. Use it for "Find Element(s)", "Find Element(s) from Element", "Find Element(s) from Shadow Root" Testing: `tests\wpt\tests\webdriver\tests\classic\find_element*\find.py` --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
f682f9d6f5
commit
d781d1b1cb
10 changed files with 190 additions and 51 deletions
|
@ -1172,11 +1172,12 @@ impl Handler {
|
|||
WebDriverScriptCommand::FindElementsTagName(parameters.value.clone(), sender);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
_ => {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::UnsupportedOperation,
|
||||
"Unsupported locator strategy",
|
||||
));
|
||||
LocatorStrategy::XPath => {
|
||||
let cmd = WebDriverScriptCommand::FindElementsXpathSelector(
|
||||
parameters.value.clone(),
|
||||
sender,
|
||||
);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1242,11 +1243,13 @@ impl Handler {
|
|||
);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
_ => {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::UnsupportedOperation,
|
||||
"Unsupported locator strategy",
|
||||
));
|
||||
LocatorStrategy::XPath => {
|
||||
let cmd = WebDriverScriptCommand::FindElementElementsXPathSelector(
|
||||
parameters.value.clone(),
|
||||
element.to_string(),
|
||||
sender,
|
||||
);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1302,11 +1305,13 @@ impl Handler {
|
|||
);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
_ => {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::UnsupportedOperation,
|
||||
"Unsupported locator strategy",
|
||||
));
|
||||
LocatorStrategy::XPath => {
|
||||
let cmd = WebDriverScriptCommand::FindShadowElementsXPathSelector(
|
||||
parameters.value.clone(),
|
||||
shadow_root.to_string(),
|
||||
sender,
|
||||
);
|
||||
self.browsing_context_script_command::<true>(cmd)?;
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue