-
Notifications
You must be signed in to change notification settings - Fork 12
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
Possibility to use Relative path for element finding #109
Comments
Hi, Xpath can be used asweel by Tree Searching usage. Here are some of Examples --> https://github.com/GDATASoftwareAG/robotframework-flaui/blob/documentation/examples/xpaths/xpaths.robot https://github.com/GDATASoftwareAG/robotframework-flaui/blob/documentation/examples/xpaths/ https://gdatasoftwareag.github.io/robotframework-flaui/xpath.html You are able to search on a Combobox pattern with your example. Properties like @name, @AutomationID or @Class can be used here. Automation ID should be used by general and can be set to most of all GUI Application to identify all gui elements directly or search for them if a pattern is generated. Syntax with Array usage below is a way to go but for my opinion not recommended. Hope that helps for you and you can adjust your PoC. |
Thanks @Nepitwin for direction to look into. We have application which responds well to UIA2, with UIA3 we get methodnotimplemented error. When i provide full XPATH -> TEST PASSEDLibrary FlaUILibrary UIA2
|
Your xpath can be easier handled. /Window[contains(@name,"Deposit/Loan")]/Pane[2]/Pane[1]/Edit[@name="Name:"] Can be adjusted to /Window[@name="Deposit/Loan"]/Pane[@AutomationID="59648"]/Pane[@AutomationID="59649"]/Edit[@AutomationID="59652"] This usage is a direct execution by AutomationID Properties which should be static. So your test will be always successfully if not changed by any adjustment. Your approach is intresting because you try to search an element by a given name from all subtrees. /Window[contains(@name,"Deposit/Loan")]//Edit[@name="Name:"] I think tree search is here searching only on the level after Window. So editbox could not be found. But i think it should be exists something simillar on xpath like * to indicate so search to all sub elements https://www.w3schools.com/xml/xpath_syntax.asp /Window[contains(@name,"Deposit/Loan")]//*//Edit[@name="Name:"] I will check if something exists like *. Sadly i don't found any documentation for xpath usage on desktop automation since today. It would be nice to see what can be done by these xpath usages here. |
@savitakul Your problem is related to the issue #82 The first matching element will be taken as the right element. |
Thanks @noubar will try the approach with automation ids instead. I think that will be most reliable way to handle the xpath. |
Hi,
We are checking if RobotFramework-Flaui is suitable for out test developement. Our team have around 1000+ tests in Coded UI and looking to shift to robotframework tests. We are considering the Flaui for test shift and new test development but during PoC we stuck on below issue -
Unable to locate element with Relative XPATH.
We have desktop application which has lot of pane and containers, the elements are located within these panes.
Example:
We are able to locate element with xpath: /Window[@name='XYZ']/Pane[2]/Pane[2]/ComboBox[2]
But this will be hard to maintain the XPATH, will it possible to access these elements with Relative XPATH, something like this -
//ComboBox[@name='abc'] ---> Search element anywhere on screen which is visible with given name ?
Appreciate the help!
The text was updated successfully, but these errors were encountered: