Loop dont Work

Hi every Body,

I have a problem with my Loop (While),
I want to dowload All PDFs existing in my page (web).
For My pdf target i have a Selector i called SelPDF with this Initial value ("")
I remplace the ## WITH my Variable i ( i = 1 ) and I increament my i in the end of loop.

I Recover the first pdf succesufuly And my While Loop on the first pdf always with the same i = 1 through i it was incremented with the value 1+1 ( i = 2)

Loop.xaml (17.1 KB)

Thank you for your helping.

Sorry but i am not getting what u want to do
you increment the counter at the end but you have not put it in loop

Can you extract selectors for 2 pdfs and post it here?
Let have a look and then see what your while loop is doing

Hi ImPratham45,
Yeah i See the Increament it is not in the Loop. I tested All places in the Loop but its not works.

@nadim.warsi, the selector for the seconds pdf is :<html title='AO6581 - Mise en oeuvre Kofax - S1 2019' /> <ctrl idx='2' name='Voir PDF' role='graphic' />

Thank you for All

1 Like

Try this one. It should work.Loop.xaml (17.1 KB)

One thing. Im not sure why you have used while ‘True’. If this is just for testing then its fine otherwise this loop will not exit anytime as condition is always true.

I suggest you get the count of the pdfs on the page and then in the while use i <= countofpdf

Second, you dont need to use ## and then a replace. You can directly use i.tostring in your selector
"<html title='AO6581 - Mise en oeuvre Kofax - S1 2019' /> <ctrl idx='"+i.toString+"' name='Voir PDF' role='graphic' />"

hello i am also not getting what happend but tried this nd its working
pls assign your Selpdf in loop ie insted put default value .then in that insted “##” put your counter ie “i”

then it is working

1 Like

if you are satisfied with solution then pls mark it as solution
Happy automation

Thanks and Regards,
Prathamesh Patil

No, its not working
i have this error


is the selectors is ryt which u want?
pls check by using message box after assigning.

With Message Box I have got this Message for the Selector

Loop.xaml (18.7 KB)

pls check and let me know

I thought your i started from 1 and not zero.
Have you defaulted it to 0 for first loop?

Thank you for you @ImPratham45 and @nadim.warsi

Its working now, the robot click at the second PDF
Once the robot downloads the first pdf ( All Ok without problem), But the robot takes a lot of time to click on the second pdf. once it clicks on the pdf it puts again a lot of time to click to save it

I do not know why he puts a lot of time to click?

No, the default Value of i is 1

share your final xaml let me see if it requires any tweak

I think I have a problem with this Popup box


the robot can not click quickly at the Button Oui
The Robot makes lot of the time to click on the button
And I have Anathor problem
image
the while it is always True

@nadim.warsi
tt.xaml (20.2 KB)

My Loop

Try this tt.xaml (19.0 KB)

Now couple of things.

  1. In above i have added simulate click enabled and waitforready property to none so it may be fast. you can test and let me know
  2. I told you that While with True will not work. You will need a condition. So,
    a. Is there a way to get the count of number of pdfs that are there on the page. May be a place where the webpage is displaying the count of files listed. If yes, then get that value using getText and the add that in the loop like i mentioned in the above post.
    b. If there is no count on the web page. Use a boolean variable say ‘pdfexists’ and default it to True. Use this in your while look condition. Inside your while after you set your selector use a ElementExists activity. After that use a IF in which Then will be the rest of the steps that you already have and Else will have an assign pdfexists = false that way your while will exit when next pdf is not found (say 4)

Something like this structurewithExists.xaml (22.1 KB)

Ok, Thank you Nadim,

I will test it and I will let you new later ok

1 Like

Thank you very much @nadim.warsi and @ImPratham45
The Loop working well
But the robot makes a lot of time to click on button for the second and third Pdf
I share with you the Log
Log.xml (29.8 KB)

1 Like