简体   繁体   English

在树莓派上使用Selenium和Python登录zoom时出现401错误

[英]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;我正在学习使用 Selenium,我的目标是在 Raspberry Pi 4 上通过 python 程序打开缩放。运行粘贴的代码后,程序按预期工作; opens zoom in browser, maximizes window, selects and clicks sign in, enters credentials and then presses enter.在浏览器中打开放大,最大化 window,选择并单击登录,输入凭据,然后按回车键。 After log in is attempted I am given "error: Http 401 error".尝试登录后,我收到“错误:Http 401 错误”。 I am guessing this is because zoom is detecting an auto-login and blocking me.我猜这是因为 zoom 检测到自动登录并阻止了我。 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.我遇到了同样的问题,并且能够通过使用未检测到的 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")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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