Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPath location syntax using Element.Current.Name results in an unexpected/awkward syntax #63

Open
acolomitchi opened this issue Mar 3, 2018 · 1 comment

Comments

@acolomitchi
Copy link

In the XML context, an XSL locator with element_name[filter] will search for elements (tags) with the type of element_name not with the attribute @Name=element_name.
e.g. button[string(current())='Cancel'] will select a button labelled 'Cancel'.

Due to the implementation of internal override string Name property of the Winium.Cruciatus.Helpers.XPath.ElementItem, an XPath with the same effect as the one in the example becomes something like Cancel[@ClassType='Button'].
If the label of the looked-for button happens to have multiple words, then the xpath becomes *[@ClassName='Button' and @Name='I agree'], because there's no way something like
'I agree'[@ClassType='Button'] can be interpreted as a correct XSL syntax.

Suggestion: switch from return this.element.Current.Name; to return this.element.Current.ClassName; or return this.element.Current.ControlType.ToString();
(yes, the suggested change may break existing code that rely on this behaviour, a WontFix resultion for this one may be legit)

@acolomitchi
Copy link
Author

acolomitchi commented Mar 3, 2018

(perhaps this issue is better moved againts Winium.Cruciatus)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant