Not able to give ring to my phone using find my device feature. Infact it is not even logging in

Viewed 58
from selenium import webdriver 
from webdriver_manager.chrome import ChromeDriverManager
import pyautogui
  

gmailId="umeshbalraj12@gmail.com"
passWord="*****"
try: 
    driver = webdriver.Chrome(ChromeDriverManager().install()) 
    driver.get(r'"https://www.google.com/android/find"')
               
    time.sleep(2)
    pyautogui.typewrite(gmailId)
    pyautogui.press("enter")
    time.sleep(2)
    pyautogui.typewrite(passWord)
    pyautogui.press("enter")
    time.sleep(5)
    pyautogui.click(x=85,y=231)
    time.sleep(2)
    pyautogui.click(x=200,y=495)
    pyautogui.hotkey('ctrlleft', 'altleft', 'l')
  
    print('Login Successful...!!') 
except: 
    print('Login Failed') 
1 Answers

So the actual error for this is really funny. You haven't imported the time module, so when you call time.sleep, it returns an error.

Here is what I did to finish the code of and ring my device:

from selenium import webdriver 
from webdriver_manager.chrome import ChromeDriverManager
import pyautogui
import time # NEEDS TO BE IMPORTED!!!!!
  

gmailId= pyautogui.prompt("Please Enter Your Gmail Password:")
passWord= pyautogui.password("Please Enter The Password For " + gmailId + ":")

driver = webdriver.Chrome() 
driver.get(r"https://www.google.com/android/find")
driver.maximize_window()
           
time.sleep(2)
pyautogui.typewrite("eesamaster1@gmail.com\n")
time.sleep(2)
pyautogui.typewrite(passWord)
pyautogui.press("enter")
time.sleep(5)

print('Login Successful...!!')

time.sleep(2)

print("Refreshing Information For Device")
pyautogui.click(x = 750,y = 550) #Clicks the refresh button

time.sleep(1)
pyautogui.click(x = 500,y = 750) #Clicks the ring device button

input("Please Press ENTER When Your Device Has Been Found: ")
pyautogui.click(x = 500,y = 1150) #Clicks the stop ringing button

Also, it's a good idea next time to try your code outside of the try and except command to see what the actual error is!

Related