Dynamic Website Search

I have a requirement to go into the multiple webpages and search for the particular product and the get the data out of that page, How can we able to program the code to type into the search bar (where ever the search option is on the webpage) and click on the search button(where ever the search option is on the webpage).

Here the sample images for the website interface:


Hi Kumar,

So, If I understand correctly you want a bot that is able to generalize, for any webpage, right?

The approach depends on how many different sites you want to visit. If it’s a small number, to be honest, I would just create a case for each site. If it’s a large number, then may try using the Find Child Item in the site and search for elements of type “search” (use the inspect option of your browser or the UiExplorer). The button can be more complex but maybe you can find a tag call “submit” or “input”. If the thing gets more complex from here, with multiple search bars and submit buttons then you will have to write an algorithm that chooses which one.

glhf

1 Like

It is for the multiple webpages consider it around 50 webpages, Can you please help me with any images how can we able to select using the inspect option of the webpage.

My doubt is: do you really need to click on the search button? because most search engines allow you to search by sending the hotkey “enter”. If you use the hotkey you could use the same selector as the search bar (which should be much easier to find).

Any way. To find the search bar, I did a small test with Find Child Item:


and it was able to find the search bar for Google, Gmail and SharePoint. It’s a small sample set but maybe it helps. You may have to adjust values or check more than one element of the list that this function returns.

1 Like

OK, the search bar we are finding using the find children activity but after that I am using the type into activity but the UiElement is not accepting the input(listchild).

Hi @Varunkumar_Saikumar,

I understand that listChild is a list of elements found by that activity in which case you will have to provide at which index, desired element(search) was found.

Regards
Sonali

can you please help me with the syntax how can extract the index of the desired element,
imagine if the index 2 is the one we are looking for.

Hi Kumar.

If you want to access the one with the second index (aka the third element) you can do so by: listChild(2)

On a second note, and without no meaning of disrespect, I think you are trying to tackle a problem too complex. Please, consider doing some of the advance Academy training. It may help you getting some ideas on how to handle this. This process, the way you are explaining it, would be considered hard by any RPA developer, no matter the level.

Hi @Varunkumar_Saikumar,

When you are looping through listChild, try printing listchild(index value here) or whatever counter variable you are using in For each loop and see if it prints all values ok.

As and when the value you are looking for is found, break out of the loop and use that index/value in your next activity.

Regards
Sonali