Selenium 关闭我的Chrom窗口,没有错误信息

2024-10-03 13:22:27 发布

您现在位置:Python中文网/ 问答频道 /正文

干草

我的问题是:

当我启动代码时,它会打开一个窗口,然后打开另一个窗口,以此类推。4个窗口关闭后,4个窗口之间有一点延迟,程序会像什么都没发生一样打开一个新窗口,然后打开一个新窗口,以此类推,5个窗口关闭后,这一切会一直持续到最后

背景资料:

  • 带有Selenium的最新Python版本

  • 谷歌Chrome浏览器

  • 我没有收到任何错误消息

    browser = webdriver.Chrome(driverPlace)
    browser.get(url)
    time.sleep(0.5)
    browser.maximize_window()
    time.sleep(0.5)


def startCheckLogins():
    x = 0
    stay_active = True
    with open(filePlace) as file:
        for x, line in enumerate(file):
            x + 1
            login()

    while stay_active:
        stop = input("Choice: ")
        if stop in ["quit", "q", "exit"]:
            stay_active = False


#program start message
startCheckLogins()

Tags: 代码in程序browsertimesleepchromefile