Programming question about type/sendKeys/xtype on instagram.com

I want to load a list of my instagram followers (1.000+). Am I reinventing the wheel or has someone already programmed this? I have ran into problems and this is my approach:

After login, I can’t directly open | https://www.instagram.com/${userID}/followers
So: open profile page and click on link to open the follower popup window:

open | https://www.instagram.com/${userID}
click | xpath=//a[@href=‘/${userID}/followers/’]

Problem: Only the first 12 followers are loaded. In order to get the next 12 items in the list, I need to press or in the list.

-sendKeys and type won’t work as I can’t figure out which target locator to to use
-to get focus into the list in the popup window, start with: xtype | ${KEY_TAB}${KEY_TAB}
-then I have a loop working on the 12 loaded items
-last thing in the loop is to load the next 12 items: xtype | ${KEY_END}

My approach takes a lot of time to get all followers (1.000+) and consumes more than 25 xtypes (limit in the free version). Any idea how to do this better? For instance, is there a way to keep the ${KEY_END} pressed for an amount of time, thus using only one xtype? Or to programmically call the javascript functions of the web page to load the next 12 items? Any other hints?

Thanks for help in advance!

There isn’t a function to hold down a key. I would upgrade to the personal edition license to get unlimited XType and you help support development.

Have you tried disabling lazy image loading and lazy frame loading in chrome flags?

This is an easy work to do

  1. do not use Xtype because require xmodules, with free plan you can execute max 25 commands and require focus on screen (no multi browser allowed)

To do this work using a simple mouseover or click command on footer element on the site to scroll and load the page

Try to detect a good xpath to scroll screen and use a loop to do this work.

I am using Firefox. Should I switch to Chrome and disable disabling ‘lazy image loading’ and ‘lazy frame loading’? How does that relate to my question?
I thought about upgrading to the personal edition, but it the table at RPA Software Pricing looks like that I have to pay extra for xModules then. Or is it included?

I’m not sure if Firefox has that in the config or not. Lazy loading is when the page appears and loads as you scroll and on some websites you can turn that off with the flag. That’s what you had described.

Yes, all the important parts for automation (XClick, XType,…) are included.

The only xmodule feature that is missing with the Personal Edition is hard-drive macro storage, but that is typically only needed if you work in a team. It allows you to use the RPA software with source control tools like Github.

You do get the bump up from 10 to 20 on the hard drive mode storage

You can scroll page with mouseover command is very easy I have more macros that scroll page for inifinite loop and continue to work forever in the page

I don’t know how to do this in my case. How can I address the scroll bar of the window with the xpath locator? According to selenium webdriver - How to find Scroll bar xpath? - Software Quality Assurance & Testing Stack Exchange it is not possible. Can you give me a working example, please?

I scroll in more sites without any problem.

Search an element in the footer and use it to scroll

It’s not hard scroll a page you can use click or mouseover command with an xpath in the footer

I have solved this problem with a work arround:

  • call the macro in a loop from Powershell and pass cmd_var1=1, closeRPA=0, closeBrowser=0
  • use !errorignor=true
  • after each xtype check for !statusOk
  • on error write current loop counter to log file (using echo) and break / exit
  • back in Powershell check log file with select-string. If the abort message is found, extract the loop counter and call the macro again, using cmd_var1=saved loop counter
  • at the beginning of the macro check if cmd_var1 == 1. If not, set other stuff accordingly to re-enter the loop with loop counter = cmd_var1
    until done.

Here the easy solution to scrool in every page

1 Like

Thanks for you engagement, newuserkantu. This would be a very nice and much easier solution, but it doesn’t work on the page I am on (https://www.instagram.com/<MY ACCOUNT NAME>/followers/). I have a valid xpath of a loaded element out of view and check it by ‘waitForElementPresent’. Then I tried ‘click’ (on a div with a text) as well as ‘mouseOver’ (on divs with links). No error, but no scroll into view either. Only the button ‘Find’ in the target line in the ui interface scrolls it into view. Hence, the element is loaded and the xPath is ok. And, if I ‘click’ on a div containing a link, in will be executed, but of couse I don’t want to leave the page. I want to scroll this list and I can only do it with xType.

If you find a good xpath working like a charm because the mouseover move in the element

I scroll youtube page infinite scrolling with this metode and working there is not any difference with instagram.

You must find good xpath with external tools (not only few xpath recorder by ui vision), after with mouseover tou can scroll in the page.

You can use xpath with number to move screen in your prefered position.

This can scroll unlimited page, I already tested it and scroll infinite page no limit, you can add in times the amount of followers to scroll, i added max speed but if your internet connection is slow you can set medium or slow speed.

My macro working in overlay windows opened from instagram when you click followers link, i can not see the url you posted, i use officially instagram page of followers.

I use special xpath in my language you must replace “Segui” with your string (it change with your language)

xpath=(//button[text()='Segui'])[${!TIMES}]

I specialized in making fast professional macros that work well and that can be followed with multiple browsers together, usually I work with multiple browsers together and therefore I do not use Xclic and Xtype that do not allow you to use multiple simultaneous browsers.

I know how to make any macro for any work and in 99% of cases I use standard selenium commands so the macro you can use it in both ui vision and Katalon Recorder and does not need Xmodules.

This simple code can be combined with store, posting, saving, and every action in the site, it can be every action.

The same automation can be created in more ways with loop, with gotoif_v2, with gotolabel, do and repeat if and with more solutions alternative.

Macro Code:

{
  "Name": "Scroll_Instagram_Follower_Page",
  "CreationDate": "2021-1-14",
  "Commands": [
    {
      "Command": "store",
      "Target": "true",
      "Value": "!ERRORIGNORE"
    },
    {
      "Command": "store",
      "Target": "FAST",
      "Value": "!REPLAYSPEED"
    },
    {
      "Command": "store",
      "Target": "1",
      "Value": "!TIMEOUT_WAIT"
    },
    {
      "Command": "bringBrowserToForeground",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "times",
      "Target": "10000",
      "Value": ""
    },
    {
      "Command": "mouseOver",
      "Target": "xpath=(//button[text()='Segui'])[${!TIMES}]",
      "Value": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}
1 Like