Selenium 属性错误“'WebDriver' 对象没有属性‘_timeout’”

Selenium attribute error "'WebDriver' object has no attribute '_timeout'"

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from io import SEEK_END
import time
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By


Path = "C:\Program Files (x86)\chromedriver.exe"

opt = Options()
opt.add_argument('--disable-blink-features=AutomationControlled')
opt.add_argument('--start-maximized')
opt.add_experimental_option("prefs", {

    "profile.default_content_setting_values.media_stream_mic": 1,
    "profile.default_content_setting_values.media_stream_camera": 1,
    "profile.default_content_setting_values.geolocation": 0,
    "profile.default_content_setting_values.notifications": 2
})

driver = webdriver.Chrome(options=opt , executable_path= Path)


with open("data2.txt", "r+") as f:
    f.seek(0 , SEEK_END)
    if f.tell() == 0:
        MAILID = f.write("\n" + input("Enter your name_roll no (javets_6890) : "))
        PASSWORD = f.write("\n" + input("Enter the password for your mail id : "))
    else:
        f.seek(0)
        datalst = []
        for i in f:
            datalst.append(i.replace("\n",""))
        print(datalst)
        MAILID = datalst[0]

        PASSWORD = datalst[1]
def methclass():
    driver.get("https://classroom.google.com/u/0/h") #https://meet.google.com/lookup/bdzjc4fsl4?authuser=0&hs=179
    wait = WebDriverWait.until(driver , 30)
    try:
        wait.until(EC.presence_of_element_located((By.NAME , "identifier")))
    finally:
        mailbox = driver.find_element_by_name("identifier") #looks for the mail id box in the sign in page
        mailbox.send_keys(MAILID) #sends this text into the box for mail id
        mailbox.send_keys(Keys.ENTER)

    try:
        wait.until(EC.presence_of_element_located((By.NAME , "password")))
    finally:
        passbox = driver.find_element_by_name("password") #looks for mail pass box
        passbox.send_keys(PASSWORD) #sends pass to box
        passbox.send_keys(Keys.ENTER)

    time.sleep(10)

    driver.get("https://meet.google.com/lookup/bdzjc4fsl4")

    wait = WebDriverWait(driver , 180)
    try:
        wait.until(
            EC.presence_of_element_located((By.CLASS_NAME, "Fxmcue")))  # sees whether join button is present or not
        driver.refresh()
    finally:
        body = driver.find_element_by_xpath("//body")
        body.send_keys(Keys.LEFT_CONTROL , "e")
        body.send_keys(Keys.LEFT_CONTROL , "d")
        join = driver.find_element_by_class_name("Fxmcue")
        join.click()
    time.sleep(2400)
    driver.quit()
methclass()

如何修复属性错误? 代码 运行 很好,直到我添加等待并尝试除了块,我使用 time.sleep() 而不是等待,代码 运行 就好了。 ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... .....................................

您对 wait 对象的实例化是错误的。
而不是

wait = WebDriverWait.until(driver , 30)

使用

wait = WebDriverWait(driver, 30)