7

selenium firefox 多标签页自动关闭问题

 2 years ago
source link: https://www.v2ex.com/t/827018
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Python

selenium firefox 多标签页自动关闭问题

  pandameng · 1 天前 · 278 次点击
python 3.9 selenium 4.1
模拟手工操作,一窗口打开多页面等待到指定时间做后面流程.
但过五六分钟后页面慢慢自动关闭,先打开的页面先被关闭,最后只剩一个页面,还没有相关日志.

查了下资料大概有两种情况
1.设置参数 options.set_preference('detach', True)解决
2.pycharm 可能会回收内存,在命令行执行就没有问题

两种都试了没有解决,而且 mac/windows 都会出现关闭现象,目前只能猜测
1.最后还剩一个页面,那可能其他页面因为长时间未使用被垃圾回收了
2.驱动 /浏览器版本不兼容或参数没起效果

有思路的兄弟帮忙参考下

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK