I am writing python code to jump the mouse cursor to the comment box of a Facebook post as below to write a comment but not work, using google chrome.
import pyautogui as P
import time
import os
def StartChrome():
command = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
os.startfile(command)
time.sleep(10)
def PostComment(fburl, fbcmt):
P.hotkey('ctrl', 't')
P.typewrite(fburl.lower())
P.typewrite('\n')
time.sleep(10)
P.press("C")
time.sleep(2)
P.typewrite(fbcmt)
P.press('enter')
StartChrome()
PostComment('https://m.facebook.com/groups/1430431143824643/posts/1896340613900358/','Welcome')
Everything worked fine (opened new tab of chrome, loaded the post successful) but mouse cursor didn't move to the "Comment" box of the post after the line P.press("C"). Do I wrong anything of using hot key of facebook?