Kubas
Kubas

Reputation: 1028

How to clean up waiting requests after Selenium webdriver connection timeout

Hi I have question about Selenium hub capacity/waiting for slots

Using docker-selenium:

Python connection code:

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

at first run its OK, but with second code is waiting for free slots and after 3 seconds I'm getting connection timeout from selenium/webdriver/remote/remote_connection.py (thats fine). But request is pending = in Grid Console there is info:

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: }

After releasing the slot, chrome is starting with data:, in url and nothings happend. Thats why I want to clean pending requests on timeout.

How to remove this waiting request on connection timeout ?

Upvotes: 1

Views: 832

Answers (1)

Kubas
Kubas

Reputation: 1028

I still don't know how to clean this waiting requests. But maybe is better to use server timeout than client timeout. So use newSessionMaxWaitTimeInSeconds flag when running Selenium instead of client timeout.

That's solves most of my problems right now.

Upvotes: 0

Related Questions