Hi so I am building a bot that iterates through a number of select menus, and after all of the select options are chosen, a button is clicked and queries the database and the page reloads and displays a data table that I wish to extract data from. Iterating through the select menus is working fine, but when I add the click activity which reloads the page and returns the data table, it appears that I am losing all of the results of my find children activities. This is how the project is structured:
Find Children - from select menu (IEnumerable UIPath.Core.UiElement)
For Each (UiElement)
Get Attribute (aaname) > saved as string
save as data row
after the first iteration the page reloads and displays the query results and then I lose my IEnumerable from find children activity. I know that the problem is not because of the indication on the screen or the anchor because it worked perfect before I added the button that reloads, and that it has something to do with clicking the button to reload the page. It appears I lose all the find children IEnumerables and they cannot be passed to the Get Attribute Activity after the first iteration and page reload. What is the mitigation for this? If I call another find children activity at the beginning of the for each, then it will start over at the first option, and if I do a delay activity, the length of time varies. Any suggestions?
Do you have any exception? Can you share it?
sure, sorry I forgot
Get Attribute: Attribute not supported by the current UiNode.
Get Attribute: The UI element is invalid. Make sure the target application is open and the element is on the screen.
The target application is open and the element IS on screen, but I guess it loses it when the page reloads?
Probably because it’s not recognized as same UiElement after reload.
So, as workaround, if the page structure is same after reload, can you try selector string instead of UiElement, as the following?
arraySelectorString = ieUiElement.Select(Function(u) u.Selector.ToString).ToArray
Then iterate and use it in Selector property of GetAttribute.
So to change it to selector string, do I do this in the UiExplorer? This is my first time doing this can you walk me through it?
Can you try as the following?
I tried all different types of variable types and it doesn’t like my function for some reason, can you tell me what I’m doing wrong? Thank you so much for your help it’s my first time working with functions in UiPath Studio
Do you use C#? If so, the expression will be the following.
arrSelector = children.Select(u => u.Selector.ToString()).ToArray()
it is c#, is it my data types? this is exactly what you posted as the formula, the find children activity is IEnumerable, and the assign activity outputs UiPath.Core.Selector, but I tried String array for find children output, and a couple others and still nothing. Thank you
string type. Then set it left side in Assign, and set
children.Select(u => u.Selector.ToString()).ToArray() in right side as the following.
Ok so that fixed that problem, but how am I supposed to use the get attribute activity with the Array if it only takes UiElement? I have to use the get attribute to access the individual option’s inner text right? Thank you
without the get attribute, the itemRegion in the for each looks like this.
If there is a way to only select the aaname in the UiExplorer (in the ss its ‘Americas’), then that would be ideal if it can survive the page refresh, I’m looking for some way to do it in the UiExplorer now…casting the string to UiElement in the foreach TypeArgument does not work either
Ok I’ve been looking and trying to find a way to pass only the “aaname” to the selector array with no luck, I cant do it through the UiExplorer so it looks like I need to use the get attribute to access aaname, but get attribute only accepts UiElement, so the selector array can not work because it is declared before the for each, and now I am back to square one because I need the data structure to survive the page reload. Does anyone else have any idea on a solution? I can’t find anything like this, should I try putting the select options in a datatable? Wil that survive the page reload? I am thinking that datatables do not survive page reloads because none of my data rows are written after the reload when I step out of the for each. There has to be some way to deal with this use case right?
I’ll attach a simple sample as the following. Can you check this?
Sample20220428-1CS.zip (3.4 KB)
Hey again, thank you so much this helped me figure out what’s going on. So we have 2 different Get Attribute activities. I have a brand new version of UiPath Studio, and my foreach is iterating through strings
my Get Attribute activity is from
And this Get Attribute only accepts UiElement as input.
I am able to copy and paste your get attribute element, but am I missing something? I am not able to search and find the Get Attribute that you have. How can I fix it? I do not only want to use Get Attribute for UiElement…thank you so so much for your time
I’ll share modern version sample as the following. Please check sequence.xaml
Sample20220428-1CSv2.zip (17.7 KB)
note: If we indicate some element once, we can set selector string in Target category.
I got it! I needed to put my string in the strict selector rather than input element as you suggested. Thank you thank you thank you you’re a genius
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.