I want to use a “OR-Condition” for an aaname value in a selector. I am often faced to login pages. Those are sometimes in englisch, sometimes in german language. So, aaname of the Login-Button is “Login” or “Anmelden”.
I know that it works, because I already did it… long time ago in a project, i cannot find anymore
So, I want something like this:
html app=‘chrome.exe’
webctrl tag=‘BUTTON’ aaname=‘Login’ || ‘Anmelden’
Does anyone know how to make it - it should be an easy syntax in the UI Explorer.
I post this question to get known, how to deal with those topics in an elegant way. Please do not answer, if you do not know the answer. I don’t want a workarround.
The idx attribute represents the ordinal position of an element that matches the other specified attributes. In this case, you can use it to select the first element that matches either “Login” or “Anmelden”.
Open the UiExplorer by clicking on the “Indicate Element” button in the UiPath Studio, and then click on “Indicate Element” again.
In the UiExplorer, find the “aaname” attribute and click on the small edit button (pencil icon) next to it.Replace the existing selector value with the following:
This creates two separate lines in the selector, each representing a different language option. UiPath will try to find the element using the first line. If it doesn’t find any matching element, it will automatically switch to the next line, which represents the other language option.
the value to the loginButtonText variable based on the language or other conditions. For example:
If the language is English: loginButtonText = "Login"
If the language is German: loginButtonText = "Anmelden"
This way, you can make your selector dynamic and handle different languages effectively. It requires a bit of setup to set the loginButtonText variable correctly, but it should work as expected.