如何关闭 Python selenium webdriver 窗口 [英] how to close Python selenium webdriver window

查看:46
本文介绍了如何关闭 Python selenium webdriver 窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Python 脚本,可以每小时从网站上抓取数据.它目前存储在服务器上并且运行良好,因为我正在使用任务调度程序来安排它每小时执行一次脚本.

I have a python script that scraps data off from a website on an hourly basis. It is stored on the server at the moment and is working well as I am using task scheduler to schedule it to execute the script on an hourly basis.

我正在使用此代码

driver.quit()

退出浏览器窗口

我的问题是,每当我没有登录到服务器时,它就会开始堆积 webdriver 窗口,因为当我登录到服务器时 driver.quit() 函数以某种方式不起作用.每天早上上班时,我都有很多窗口要从服务器关闭.

My problem to this that whenever I am not logging in to the server, it will start stacking up the webdriver window as somehow the driver.quit() function does not work when I am logging into the server. every morning when I came to work, I have tons of window to close from the server.

我尝试退出、关闭、处理,但无济于事.我还能尝试什么?

I tried to quit, close, dispose, but it doesn't help. What else I can try?

推荐答案

在 python 中使用 chromedriver,我退出 Chrome 进程:

In python using chromedriver, I quit Chrome processes with:

driver.close()

这篇关于如何关闭 Python selenium webdriver 窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆