Logic to get back to current page

Hi, I am automating a webpage.

image

There are 5 items in every list on the page, and the page range is dynamic. If I select one item from any page to see its details, after viewing the details, the only option I have is to come back to the previous page to select the next item.

image

The problem is that when I come back, it automatically loads the first page every time, even if I am coming back from the 3rd page. It always loads the first page when I click back.

Any idea to build this logic could help

Thanks in advance.

Hi @jai_kumar2

Can you please tell how many pages are going forward when you click the right arrow and also how many pages are going back when you click the back arrow.

Regards

Hi @jai_kumar2

There is another chance of getting your condition satisfied:
->get the number stored just after the right arrow by using the get text activity and store the value in a variable let’s say Extractedvalue and later convert it to integer data type and let’s say the new variable as LastPageNumber.

LastPageNumber(integer data type) = CInt(Extractedvalue)

->take a count variable and initialize as integer Data Type and assign the value as 1.
use an while loop and give the condition as Count<=ExtractedNumber
->You please check the URL for all the pages and please verify if there is page number’s coming in that URL.
->If yes, then please make the URL dynamic by passing the Page numbers through a Countvariable into the URL.
->And pass the dynamic URL into the use application/browser and so that it opens the URL one by one and you can achieve all the pages.
->Increase the count variable after the Use application/Browser and within the While loop.

Regards

HI @jai_kumar2

Check the below flow for better understanding:

xaml:
Sequence.xaml (14.3 KB)

Regards

@jai_kumar2,

Simple hack would be

  1. Get current page selector and non current page selectors from Ui Explorer.
  2. Compare them what’s the attribute of Page Number Ui Element which is current page have and non current page numbers missing.
  3. Once you found out the argument, customize the selector to have * as page number and that attribute as mandatory.
  4. Use Get attribute activity to get number from Selector you built in Step 3.

Thanks,
Ashok :slight_smile:

Another way is to save the current page URL and use it with the activity “Go to URL” to navigate back.

Don’t click the item. Scrape its URL and use a Use Application/Browser to open that URL in a new tab.