Click same button everywhere in a page

Hi,
I have a set of product reviews in a web page. After a set of reviews, i need to keep clicking ‘more reviews’ button to continue reading reviews. I need to automate the ‘more reviews’ button click.Is there a solution?

1 Like

@Gopalakrishnan_K Use While or Do While activity

Hi @Gopalakrishnan_K

You can do something like below

Let me know if it helps

Fine
There are actually two scenarios on this

—if it’s a same single button then we can use CLICK activity itself within a RETRY SCOPE a where in the do part we can use click activity and in condition part use ELEMENT EXISTS activity so that it will keep clicking until the element vanishes

—second one is if it’s same but multiple button that is if there are more than one “more reviews” button on the UI, then we need to increment the index because that element being repeated will have some index (still we need to check with selector) in its selector, which can be replaced with a variable and incremented within a WHILE loop so that until all such button is clicked the loop will keep executing

Cheers @Gopalakrishnan_K

Hi @Vishal_K,
I think button ‘more review’ is chosen with respect to the position and so ‘Cannot find element’ exception shows after an iteration.How to retrieve text alone and check if element exists?

Hi @Palaniyappan,
Initially few entries will be listed .After clicking ‘more reviews’ button, 5 more entries will be listed followed by the same button.This will continue till the end of the list. Will ‘click text’ and ‘element exist’ work here?

@Gopalakrishnan_K

Oh, which means your more review button selector is kept changing with each click? then can you try using click text activity with ‘more review’ as the text name and use the logic I explained above?

Also If you used a normal click then try to check the selector generated with each click and compare the selectors and try to make it dynamic?

Also if it is a website and accessible to everybody then please share the link with us, maybe we can get more ideas?

Yah it would of course
but i would recommend to go for CLICK activity rather CLICK TEXT, as there is a chance of exception and is more when compared to click activity

In click activity select the element and make sure that the attribute which looks dynamic is handled with wildcard symbol and thus enabling it to access the button on different pages or instances

It would be great if i can see the UI with a screen shot on how it actually looks so that we can get through the right and precise direction

Cheers @Gopalakrishnan_K

Hi @Vishal_K and @Palaniyappan ,
https://www.healthgrades.com/providers/jeannette-musset-xyn9j7l?referrerSource=autosuggest
Here is my link. Please check the rating page.

This is what you needed @Gopalakrishnan_K

Please open the website and run this xaml file
Main.xaml (8.6 KB)

Note: I have used Chrome browser and tested. If you are using explorer then just indicate screen for element exists and click activity on Show more review

@Vishal_K,
This file contains unresolved activities.


Can you take a screen shot of these activities and send?
Don’t know why it appears as such

@Gopalakrishnan_K

here you go the screen shot
The selector for both element exist and click activities are
<html app='chrome.exe' title='Dr. Jeannette Musset, NMD | Scottsdale, AZ | Healthgrades' /><webctrl aaname='Show more reviews' parentid='premium-review-section' tag='A' />

image

Hi @Vishal_K
How and where can selector be added ?

@Gopalakrishnan_K

Click on the activity (element exist and click) and in the property panel you can add the selector. Please find the below screenshot

Note: You just use Indicate On screen and indicate “show more reviews”, it will auto add the selector

@Vishal_K,
If i am using firefox ,IE or edge ,what i should give instead of chrome.exe?

@Gopalakrishnan_K

Open your IE then use indicate on screen button as show in this screen and click on the show more review it will automatically take the selector of the browser.

As of now in your case use the followin selector for IE
<html title='Dr. Jeannette Musset, NMD | Scottsdale, AZ | Healthgrades' /><webctrl aaname='Show more reviews' parentid='premium-review-section' tag='A' />

Note: Please go through the UIpath selector tutorial for more

@Vishal_K,
it worked well. Thank you for your time. Please go through another problem and give the solution.


in which the solution isn’t appropriate enough.

1 Like

@Gopalakrishnan_K

Oh great congrats! it worked, mark this as solution then
Let me check your other post then.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.