1

I am trying to automate emails sign ups. When I do it manually it works, but when I open the website with selenium it does not. It has verification which I can't do. Is there a way to just open (not control, I use pyautogui for that) a website without detection?

My code:

from selenium import webdriver
import time
from RandomWordGenerator import RandomWord
import pyautogui

rw = RandomWord(max_word_size=9)
option = webdriver.ChromeOptions()
url = 'https://mail.tutanota.com/signup'
drive = webdriver.Chrome('/home/fares/Desktop/chromedriver_linux64 (2)/chromedriver')
option.add_argument('--disable-blink-features=AutomationControlled')
option.add_argument('--disable-blink-features=AutomationControlled')
drive.get(url)
time.sleep(3)

pyautogui.click(370,593)
time.sleep(1)

pyautogui.click(386,527)
time.sleep(1)

pyautogui.click(386,545)
time.sleep(1)

pyautogui.click(616,602)
time.sleep(1)

pyautogui.scroll('-20')
pyautogui.click(435,261)
pyautogui.typewrite(rw.generate())
pyautogui.doubleClick()
pyautogui.hotkey('ctrl', 'c')
time.sleep(1)

pyautogui.click(403,336)
pyautogui.typewrite('Sf320@sgiu')
time.sleep(1)

pyautogui.click(403,479)
pyautogui.typewrite('Sf320@sgiu')
time.sleep(1)

pyautogui.click(337,560)
time.sleep(1)

pyautogui.click(332,620)
time.sleep(1)

pyautogui.click(407,674)
time.sleep(10)
m02ph3u5
  • 3,022
  • 7
  • 38
  • 51

1 Answers1

0

Try adding these lines :

from selenium import webdriver  
from selenium.webdriver.chrome.options import Options  

Chrome_Options = Options()
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"]) 
options.add_experimental_option('useAutomationExtension', False) 
driver = webdriver.Chrome(options=options, executable_path=r'C:\ProgramData\Anaconda3\chromedriver.exe')
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
  "source": """
    Object.defineProperty(navigator, 'webdriver', {
      get: () => undefined
    })
  """
})
```
BlackMath
  • 1,708
  • 1
  • 11
  • 14