简体   繁体   中英

Error 401 while using Selenium and Python to log into zoom on Raspberry Pi

I am learning to use Selenium and my goal is to open zoom through a python program on a Raspberry Pi 4. Upon running the pasted code, the program works as intended; opens zoom in browser, maximizes window, selects and clicks sign in, enters credentials and then presses enter. After log in is attempted I am given "error: Http 401 error". I am guessing this is because zoom is detecting an auto-login and blocking me. First off, am I correct? And if so, is there any way to get around this? Or does zoom block any auto filling of credentials.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()

driver.get("https://zoom.us")
driver.maximize_window()

elem = driver.find_element(By.XPATH, "//a[contains(text(),'SIGN IN')]").click()
emailField = driver.find_element(By.XPATH, "//input[@id='email']")
emailField.send_keys("email")          #"email" replaced with zoom login
passField = driver.find_element(By.XPATH, "//input[@id='password']")
passField.send_keys("password")        #"password" replaced with zoom password 
passField.send_keys(Keys.RETURN)

I faced the same issue, and was able to get around the bot-detection by using the undetected-chromedriver package.

replace

from selenium import webdriver
...
driver = webdriver.chrome()

with

import undetected_chromedriver.v2 as ucdriver
...
driver = ucdriver.Chrome()

Add this to your code, right after the libraries import, and it will work:

options = webdriver.ChromeOptions()
options.add_argument('--disable-blink-features=AutomationControlled')
#in executable_path put the path to your chromedriver.exe
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get("https://zoom.us")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM