首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何清除Selenium连接超时后等待的请求

如何清除Selenium连接超时后等待的请求
EN

Stack Overflow用户
提问于 2020-03-10 11:48:56
回答 1查看 631关注 0票数 0

嗨,我有关于Selenium集线器容量/等待插槽的问题。

使用docker-selenium:

selenium/node-chrome-debug:3.141.59-zirconium

  • python

  • 集线器:selenium/:3.141.59-Zr
  • 节点: lib: selenium==3.141.0

Python连接代码:

代码语言:javascript
复制
from selenium import webdriver
from selenium.webdriver.remote.remote_connection import RemoteConnection

def connect(hub_url, capabilities, chrome_options):
    RemoteConnection.set_timeout(3)
    driver = webdriver.Remote(
        hub_url, desired_capabilities=capabilities, options=chrome_options,
    )

    return driver

一开始运行OK,但是第二段代码正在等待空闲插槽,3秒后,我将从selenium/webdriver/remote/remote_connection.py获得连接超时(这很好)。但是请求挂起=在网格控制台中有信息:

1 requests waiting for a slot to be free. Capabilities {browserName: chrome, goog:chromeOptions: {args: [load-extension=/extension], extensions: []}, loggingPrefs: org.openqa.selenium.logging..., version: }

释放插槽后,chrome从url中的data:,开始,什么事情都没有发生。这就是为什么我想清理挂起的请求的超时。

如何在连接超时时删除此等待请求?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-12 08:15:26

我还是不知道该怎么处理这个等待请求。但是,与客户端超时相比,使用服务器超时可能更好。因此,在运行Selenium时使用newSessionMaxWaitTimeInSeconds标志,而不是客户端超时。

这解决了我现在的大部分问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60617024

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档