IF Condition not working properly for a Web Aplication

Hello,

I’m having a problem with this WEB page automation. I noticed that I have a problem with an “if” condition.
I’m trying to do a cross check between the value from an excel file and the one from the web page (line number 10 - from the above screenshot).
Even the value from the webpage is exactly the same with the one from my excel, when I run the project, it is saying that there is no match between them.
Any idea why is this happening?

Also after the match is done I need to be able to go to the next line and validate the data for the second line. How can this be done?
web-app

Thanks

Hi @LisaC

First thing first, put a breakpoint before the if statement and see the variables values to see if there is any space or other difference between the strings

I didn’t understand the second request, can you explain it in other words, please?

Thanks Gabrielle,
I will try with the Breakpoint.
Regarding my second question, let’s say that I have an xls file with line item 20, and I want to go the webpage and find line 20 (instead 10 which is the first one in the webpage). How can I iterate between each line and find the match based on line item.

Thanks

For the secon point you can use a “For Each Row” to iterate the operation for every line.

Hi Gabriele,

I added a for each activity at xls file level, but how Uipath will go to the next line on the web page (where you can see I have two lines 10 & 20) in case that there will be no match between the line (let’s say 20 from my xls ) and what is in the web page.
Basically it needs to read the value from the xls file and in case if this value is not existing in the first line from the webpage, it should go to the next line, and so on. Not sure how it can recognize that it should go to the next line.

Can you parametrize the line?

If you don’t know that, can you share a screenshot of the UiExplorer you use to check the line?

Hi,

see a screnshot from UIExplorer. Thanks.

You can change the selector as follow:

You should parametrize the selector using your string as aaname and innertext (you can do that by right clicking and selecting the variable or by changing the selector as a concat of strings in the propriety menù), this way you will always select the correct line

Ask if you need futher clarifications

Hi,

Could you please explain it in other words, please?

Thanks

Option N 1: Go to the select editor and right click on “aaname”, “innertext” and “tableRow”, a menù will appear:

Click on choose variable and use your Line_Var. This will select the row with name equal to Line_Var

Option N 2: You can change the selector definition from the propriety menù. To do that you go under Target and edit the selector as it was a string text


Linking the variable to the fields aaname, innertext and tableRow you will achive as in the option 1

1 Like

My first guess would be that the extract includes spaces. Which means you need to add a. Trim function after your. Tostring.

This is supported by your screenshot of the selectors where innertext and aaname seems to have spaces.

For the second question as the others are mentioning you need to create a variable in the selector that you can do a for each/while in, where you add to the variabel at each iteration (like a counter). Just be aware that you need a stop criteria so you don’t end up in an infinite loop. I.e. Max 10,20 runs or if some other condition is satisfied (no more rows in spreadsheet or similar.

Hope this helps.

Thanks Sonny,

You are right, there were several spaces and I used the Trim function. I also used a while function for the iteration and now it works.
But now my struggle is that I cannot navigate to the next page where the next lines are being displayed and where the loop must continue.
Do you have any idea how can I achieve this see some screenshots with the page numbers. There are 2 ways of navigating to the next page : to click on the arrow or to select the number of page from drop down list.
? SWEB page

Thanks.

Hi @LisaC

Why can’t u try with datatscrapping

Just datascrape all the numbers u want and store in excel file or datatable and iterate over it

Hope you got the logic that I told

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile:

1 Like

Hi Nived,

I want to iterate inside the WEB page and perform actions on specific line items displayed on this webpage ( beside identifying the line, I want to modify the quantity ). I’m not sure how the datascrape helps me in this case. I need to navigate inside the web page , on multiple pages.
Is there any way to achieve this without using the option you mentioned?

thanks.

Hi @LisaC

Yes sure

Like can u try in the for each where u are iterating through each numbers

After processing one iteration use click activitiy to click the forward button (as seen in the figure near to the page number drop-down)

Try that way

Hope it helps

Regards

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile:

1 Like

Hi Navid,

In case I won’t have multiple pages in some cases ( maybe just 1 page with a couple of line items displayed), if I add this click activity , Uipath will get an error because of not finding that forward button, right? What should I do in this case?
Thanks.

Hi @LisaC

For that before clicking use element exist activitiy to check whether the forward button exists or not

Then if it exist then use click activity to click the button otherwise do nothing

Hope it helps you

Regards

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile::slight_smile:

2 Likes

Hi Nived,
I gave it a try but it works very slow and when it needs to go to the next page, it stops .
In my case , there are always 10 lines displayed per page, so I want to find a line (on first or next page if the case , it can be only 1 page) . If Uipath cannot find my line on first page of 10 lines, it should go and search on the next page and so on. Is there a way to tell in Uipath if all the 10 lines have been verified and then to click on the further button and start again the search through the next 10 lines and so on.
thanks,

Hi Lisa

I guess you can have 1 page with 5 or 3? Is there any place you can extract the amount of rows on the page? Either in total or just on that page?

But you can have a counter that just counts up to 10, and then if counter=10, you can click the next button (or use element exists) and then reset the counter, however that will only work if there is exactly 10 on every page, however as mentioned above if you can extract the specific number, it is easier - you could perhaps extract the exact amount by using the datascraping tool, it could extract either the page rows to a DataTable and then you can use the .Count function on it. Or if you initially extract all of the rows, then you have a total count, and can then calculate how many pages you are expecting, and again how many rows. Try to work a little with the TimeoutMS property, and set it to 1000 instead of the default 30.

There might be a different way, but it’s a bit hard to figure out when we cannot see the page in question.

Hi Sonny,

Thanks a lot . I’ve used Try catch activity instead and it works fine now.

Cheers.
Lisa.

2 Likes