ElSnoMan/pyleniumio

NO SSL, slow driver execution

vrapsa opened this issue · 8 comments

Hey! First of all wanna say thanks for this awesome framework looks like Selenide on Java!
My issue is that when i use my test_method(py) my test is actually super slow, but my internet connection is good. I find one possible issue like i see no SSL cert while executing tests. Might be reason here im not sure.
My project is fully clear: install selenium, pytest and pylenium, nothing more. Used guidline pylenium getting started aswell.
There is no SSL cert any site, even on qap.dev while executing.

def test_try(py):
py.visit("https://www.dns-shop.ru/")
py.getx("//a[@Class='ui-link menu-desktop__root-title' and text()='Компьютеры']").click()

17 seconds to pass the test with Pylenium, but if i go to my chrome locally to check loading speed its highly fast with SSL.

image

image

the same with qap.dev

I run multiple tests against multiple websites and I get the same results. Check this out:

image

Observe that the Russian website is extremely slow to load even though there are only two steps in the test. The tests against other websites, SauceDemo in this screenshot, are much faster and have many steps.

Now, diving into the steps of the Russian test, observe that all of the Selenium/Pylenium steps are fast. So almost all the time is taken in the two steps to navigate to the website, wait for it to load, and then to click an element:

image

As for the Not Secure issue, Pylenium uses WebDriverManager to build drivers, but any local Chrome or Firefox driver uses SeleniumWire. It looks like SeleniumWire's latest update is not coming with the driver's certificate installed. With some searching, I found a few things that can help:

Edit: I've tried all sorts of driver options and capabilities and they seem to have no effect. This should only affect local drivers, but the issue is kind of annoying. I tried things like:

- "allow-insecure-localhost",
- "allow-running-insecure-content",
- "ignore-certificate-errors",
- "unsafely-treat-insecure-origin-as-secure"

I've run into this now as well, running it, and the screen is full of the certificate issues. Has Seleniumwire changed what they do, or is this something else?

I'm also experiencing some slowness and cert issues. I'll take a look and see if it's SeleniumWire. If so, which it seems to be, then I'll add a flag to use Selenium or SeleniumWire.

Edit: It's definitely SeleniumWire. I'll be adding a new PyleniumConfig flag so users can enable SeleniumWire if they want, but it'll be set to false by default. It'll look like this:

{
  "driver": {
    ...
    "seleniumwire_enabled": false,
  }
}