'Pyautogui scroll function not showing any movement

This code is so simple, when it doesn't work, I really feel clueless. I am trying to figure out what else could make the code not work.

All I am trying to do is open browser/Google, search for a keyword and then scroll on that search page. The scroll part is not working. Here is the code-

import pyautogui
from time import sleep

sleep(2)
pyautogui.press('win')

sleep(2)
pyautogui.typewrite('fire')
pyautogui.press('enter')
sleep(2)
pyautogui.typewrite('tesla')
pyautogui.press('enter')


sleep(5)
pyautogui.scroll(-20)

As you can see, very basic code. Giving it enough sleep time so it can do the whole thing nice and slow. Everything works as it should except the last step. Assuming negative scroll means scrolling down, I tried changing the number. I tried positive too. No movement. With negative digit in the scroll function I get 1 movement, as in a single click scroll down (sort of) regardless what number I put in there.

I also tried to increase the sleep time before scroll and manually select/click on the page that need to be scrolled. No luck.

Anything else I can check to make it work?

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source