Entonces, estoy tratando de escribir un script para iniciar sesión en https://us.etrade.com/e/t/user/login
Estoy usando Selenium para esto, pero de alguna manera detecta Selenium cuando se inicia y da como resultado un mensaje que dice que los servidores están abarrotados y cuando sucede, no puedo iniciar sesión. También intenté usar Undetected-Selenium así como selenium-stealth pero ambos también fueron detectados. Realmente necesito automatizar este proceso de inicio de sesión. He intentado usar solicitudes de python pero eso no funciona. Estoy abierto a cualquier otra tecnología o método que me permita hacer esta automatización. Por favor ayuda.
Aquí está mi código
from selenium import webdriver from selenium.webdriver.common.by import By from selenium_stealth import stealth import time chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') # chrome_options.add_argument('--browser') chrome_options.add_argument('--no-sandbox') # chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"]) chrome_options.add_experimental_option('useAutomationExtension', False) wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) stealth(wd, languages=["en-US", "en"], vendor="Google Inc.", platform="Win32", webgl_vendor="Intel Inc.", renderer="Intel Iris OpenGL Engine", fix_hairline=True, ) wd.get("https://us.etrade.com/e/t/user/login")
Los créditos de demostración nos habrían ayudado a profundizar en su caso de uso específico.
Sin embargo, al usar selenium-stealth , pude evitar la detección del contexto de navegación de google-chrome iniciado por ChromeDriver impulsado por Selenium con bastante facilidad.
código compatible con selenium4
Bloque de código:
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium_stealth import stealth options = Options() options.add_argument("start-maximized") # Chrome is controlled by automated test software options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) s = Service('C:\\BrowserDrivers\\chromedriver.exe') driver = webdriver.Chrome(service=s, options=options) # Selenium Stealth settings stealth(driver, languages=["en-US", "en"], vendor="Google Inc.", platform="Win32", webgl_vendor="Intel Inc.", renderer="Intel Iris OpenGL Engine", fix_hairline=True, ) driver.get("https://bot.sannysoft.com/") driver.save_screenshot('bot_sannysoft.png')
Captura de pantalla:
Con la página de inicio de sesión de ETRADE
Bloque de código:
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium_stealth import stealth import time options = Options() options.add_argument("start-maximized") # Chrome is controlled by automated test software options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) s = Service('C:\\BrowserDrivers\\chromedriver.exe') driver = webdriver.Chrome(service=s, options=options) # Selenium Stealth settings stealth(driver, languages=["en-US", "en"], vendor="Google Inc.", platform="Win32", webgl_vendor="Intel Inc.", renderer="Intel Iris OpenGL Engine", fix_hairline=True, ) driver.get("https://us.etrade.com/e/t/user/login") driver.save_screenshot('etrade_com_login.png')
Captura de pantalla: