wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 254 forks source link

SSL taking 15 seconds for every request #335

Open SevenBlocks opened 3 years ago

SevenBlocks commented 3 years ago

I'm using Ubuntu 18.04 and selenium-wire 4.3.1. I have openssl 1.1.1-1ubuntu2.1~18.04.9 installed. Using chrome driver the developer tools tab shows that every SSL connection is taking 15 seconds, which makes loading extremely slow. It was also showing the SSL certificates as invalid, but I fixed that by installing the selenium-wire root ca file.

Installed versions. selenium 3.141.0 selenium-wire 4.3.1 pyOpenSSL 20.0.1

wkeeling commented 3 years ago

Can you share your code including any selenium_wire options you're using?

SevenBlocks commented 3 years ago

I don't think I'm using any special options.

from seleniumwire import webdriver
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Chrome()
url = "https://www.mysite.com"
browser.get(url)
...

Screenshot from 2021-06-27 12-00-00

wkeeling commented 3 years ago

Thanks - that seems very strange. I'm not sure why the SSL part of the connection would be taking so long. What version of OpenSSL do you have installed - you can find that out with openssl version.

wkeeling commented 3 years ago

Also - does it happen with every site, or just one particular site?

SevenBlocks commented 3 years ago

I have OpenSSL 1.1.1 11 Sep 2018 Hmm, it actually looks like it's only happening on one particular site. It doesn't happen when I use a regular brave browser, but when I use Chrome driver with seleniumwire a lot of the SSL requests have a 15 second delay. Do you know what could be causing that?

wkeeling commented 3 years ago

I'm not sure I've come across that before so I'm not entirely sure what could be causing it.

Out of curiosity, does it make any difference if you add the option 'mitm_http2': False to your seleniumwire_options?

SevenBlocks commented 3 years ago

Actually, it does seems to be happening with multiple sites. One example is "https://reddit.com". I didn't see any delay for google.com or facebook.

SevenBlocks commented 3 years ago

Using browser = webdriver.Chrome(seleniumwire_options={'mitm_http2': False}) didn't change anything. There's still that 15 second delay.

SevenBlocks commented 3 years ago

There are some very similar sounding problems, like this one. So maybe some issue with the certificate validation.

SevenBlocks commented 3 years ago

The 15 second delay happens both with Chrome and Firefox using seleniumwire on Ubuntu 18.04.