How to scroll the web page

Hi team,

I am filling online form which has multiple fields. Can you help me to scroll the web page.

Hi @sandeep_timma

If you use the open website action and then web element action “set value” using xpath you don’t need scrolling.

But we need scroll for mouse clicks on webpage. So can you please help me how to do it ?

@dhaval_ka do you use mouse clicks on images or xpaths?

No i just have links and details to be fetched from that link so i need to navigate to details of that link and get the information.

The bot cannot scroll to a link. It can scroll several rows up or down from a certain image or a position.

What info do you have about the link, the href attribute? What details about the link do you need to get? Maybe, it is possible to do it using Xpaths…

Is it possible to share the web-page you use or is it an internal page?

Machines

This is the link where i search Verpackungsmaschinen in the input with the xpath and press enter key.

Then it goes to next page where i get list of companies. I want to click on each company it will navigate to another page and there i get email address of that company then go back to company list and do the same steps for next company. The mouse clicks works perfectly fine for first 2 companies but for the 3rd one as it is not visible on screen so it goes to exception as not found. Note i have kept wait time on going back to list of companies. it works perfectly fine if i scroll and go to the element i am going to click.

In this case you don’t need to scroll.

You need to:

  • use web element action to insert the search query in the search field and press Enter
  • define the number of pages in the result
  • for each page, define the number of links
  • for each link, click on the company’s name, on the new page save all information using xpath, go to the previous page
  • combine the saved data together in a table

You can do all of these using Xpaths.

Then you save the final table to an Excel file, for example.

I have made a sample recording (in version 2.0.5) showing how it can be done.
xpath_data_scraping.rar (6.5 KB)

Ok thank you. I will try and see if it works and will let you know.

1 Like

Great help !!! Thank you very much.

1 Like

The webelement xpath written in code for pages is not working at other machine. May be language and location of that computer is different so.

For example //a[contains(@href,‘entered_search’)] works completely fine at my end but not on another machine. I checked in inspect element, it showed 3 results of entered_search at my end and only 1 at another computer. Can you please help me with universal solution. Thank you.

In this case you can use While loop instead of For Each, and use a special boolean variable (in the below example - ‘next’) as an indicator.
At the end of each page, try to click the Next button (xpath //a[contains(text(), ‘Nächste’)] [contains (@href, ‘page’)])
If the bot can click it, the value of the ‘next’ variable stays ‘true’, and the bot continues the loop.
If it cannot click the button, the value changes to ‘false’, and it exits the loop.

Ok thank you

I get error when iterated to second time while loop as window is not defined yet Please switch to some window before.

Try replaying the recording again and see if the window is covered by some other window or popup at this time.