Search code examples
pythonautomationpyautogui

How to open chrome new tab in pyautogui. i am not getting any error but code is not working


I Am Saving Whatsapp Contacts to sheets.google.com. I am using the new_tab = pyautogui.locateCenterOnScreen('btn.png') and pyautogui.click(new_tab) To open a new tab. but its not clicking to that button i dont get any error how to fix!!

My Code:

import pyautogui    

new_tab = pyautogui.locateCenterOnScreen('btn.png')
pyautogui.click(new_tab)

Solution

  • Try this one

    new_tab= pyautogui.locateOnScreen('btn.png', confidence=.6)
            pyautogui.moveTo(new_tab[0], new_tab[1], duration=self.speed)
            pyautogui.click(interval=self.click_speed)
    

    could be work