Implement tag name selector for FindElementFromElement WebDriver command

This commit is contained in:
George Roman 2019-06-17 17:03:09 +03:00
parent dec73e4cea
commit 616a81fb27
5 changed files with 54 additions and 16 deletions

View file

@ -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) => {