mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement tag name selector for FindElementFromElement WebDriver command
This commit is contained in:
parent
dec73e4cea
commit
616a81fb27
5 changed files with 54 additions and 16 deletions
|
@ -950,21 +950,32 @@ impl Handler {
|
|||
element: &WebElement,
|
||||
parameters: &LocatorParameters,
|
||||
) -> WebDriverResult<WebDriverResponse> {
|
||||
if parameters.using != LocatorStrategy::CSSSelector {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::UnsupportedOperation,
|
||||
"Unsupported locator strategy",
|
||||
));
|
||||
}
|
||||
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let cmd = WebDriverScriptCommand::FindElementElementCSS(
|
||||
parameters.value.clone(),
|
||||
element.id.clone(),
|
||||
sender,
|
||||
);
|
||||
|
||||
self.browsing_context_script_command(cmd)?;
|
||||
match parameters.using {
|
||||
LocatorStrategy::CSSSelector => {
|
||||
let cmd = WebDriverScriptCommand::FindElementElementCSS(
|
||||
parameters.value.clone(),
|
||||
element.id.clone(),
|
||||
sender,
|
||||
);
|
||||
self.browsing_context_script_command(cmd)?;
|
||||
},
|
||||
LocatorStrategy::TagName => {
|
||||
let cmd = WebDriverScriptCommand::FindElementElementTagName(
|
||||
parameters.value.clone(),
|
||||
element.id.clone(),
|
||||
sender,
|
||||
);
|
||||
self.browsing_context_script_command(cmd)?;
|
||||
},
|
||||
_ => {
|
||||
return Err(WebDriverError::new(
|
||||
ErrorStatus::UnsupportedOperation,
|
||||
"Unsupported locator strategy",
|
||||
));
|
||||
},
|
||||
}
|
||||
|
||||
match receiver.recv().unwrap() {
|
||||
Ok(value) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue