aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.57k stars 322 forks source link

Running with Selenium.WebDriver 4.0.0-alpha07 on chrome is super slow and has no VNC enabled #1020

Closed Dor-bl closed 2 years ago

Dor-bl commented 3 years ago

Hello ,

I'm looking into moving to Selenium 4, but I have 2 major regression thus far:

  1. running with chrome is slower than before , for some reason Firefox is not effected.

  2. both browsers we mainly work with (chrome and FF no longer opens with VNC enabled)

I'm using C# and this is my code for now:

               ChromeOptions dockerChromoptions = new ChromeOptions();
                if (Options != "")
                {
                    AddOptionsToBrowser(Browser, dockerChromoptions, Options);
                }
                if (Preferences != "")
                {
                    AddPreferencesToBrowserProfile(Browser, dockerChromoptions, Preferences);
                }
                if (Extension != "")
                {
                    dockerChromoptions.AddExtension(Extension);
                }
                dockerChromoptions.AddAdditionalOption("name", testGlobalParams.TestName);
                dockerChromoptions.AddAdditionalOption("videoName", testGlobalParams.TestName + ".mp4");

                dockerChromoptions.AddAdditionalOption("enableVNC", true);
                // Currently we disable Video Rec
                //dockerChromoptions.AddAdditionalCapability("enableVideo", true, true);
                driver = new RemoteWebDriver(new Uri(DockerPort), dockerChromoptions.ToCapabilities(), remoteDriverTimeOut);`
vania-pooh commented 3 years ago

@Dor-bl your should hide any Selenoid-specific capabilities under selenoid:options key and a dictionary as a value.

Dor-bl commented 3 years ago

Thanks I will look into it . so far I couldn't find any examples online for C# on how to add a new key to browser Options .

vania-pooh commented 3 years ago

@Dor-bl this is done with AddAdditionalCapability method with latest argument set to true.

Dor-bl commented 3 years ago

@vania-pooh Great it worked! But still on chrome image test is running super slow. Any input on that issue?

vania-pooh commented 3 years ago

@Dor-bl e.g. https://github.com/SeleniumHQ/selenium/issues/8899 Is it the same performance with previous releases like 4.0.0-alpha6 ?

Dor-bl commented 3 years ago

@vania-pooh for some reason release 4.0.0-alpha06 is not available on nuget.org. so I tried 4.0.0-alpha05 and I still get the same issue. image

vania-pooh commented 3 years ago

@Dor-bl is it possible to diagnose whether this issue is reproducing when running in 1 parallel thread or are there any extremely slow actions (like clicking on a button) whereas other actions work fast?

Dor-bl commented 3 years ago

@vania-pooh all actions work slow, without exceptions

Dor-bl commented 3 years ago

Same issue on the new 4.0.0-beta1 . in addition I noticed that latest Selenoid-UI version takes a significate time to load the VNC.

vania-pooh commented 3 years ago

@Dor-bl couldn't it be related to overloaded cluster?

Dor-bl commented 3 years ago

@vania-pooh I'm Running just one test.

vania-pooh commented 3 years ago

@Dor-bl is it possible to get a dump of HTTP traffic between the test and Selenoid?

Dor-bl commented 3 years ago

Not sure how I can get HTTP traffic , but I attached the Log of the container maybe it will help. BTW, issue persist also on "Selenium.WebDriver" version="4.0.0-beta2"

Log_Beta2.txt

Dor-bl commented 3 years ago

@vania-pooh This is the log that selenoid created with Log=enabled. do you something odd? Test_477- [2FA][WEB] Selenoid Log [TC. 464136].log

vania-pooh commented 3 years ago

@Dor-bl filtered only interesting stuff:

$ grep -E 'COMMAND|RESPONSE' ~/Downloads/Test_477-.2FA.WEB.Two.Factor.Authentication.-.Activation.TC.464136.log > commands.log

commands.log

So you are just getting a timeout after a click:

2021-09-12T15:17:13.867980200Z [1631459833.868][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE FindElement {
2021-09-12T15:17:14.874689000Z [1631459834.874][INFO]: [5f7edbcf654052d2d27f6204ab032605] COMMAND FindChildElement {
2021-09-12T15:17:14.889062100Z [1631459834.889][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE FindChildElement {
2021-09-12T15:17:15.896216100Z [1631459835.896][INFO]: [5f7edbcf654052d2d27f6204ab032605] COMMAND FindChildElements {
2021-09-12T15:17:15.909763900Z [1631459835.910][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE FindChildElements [ {
2021-09-12T15:17:16.920223600Z [1631459836.920][INFO]: [5f7edbcf654052d2d27f6204ab032605] COMMAND ExecuteScript {
2021-09-12T15:17:16.931698400Z [1631459836.931][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE ExecuteScript true
2021-09-12T15:17:17.938876400Z [1631459837.939][INFO]: [5f7edbcf654052d2d27f6204ab032605] COMMAND ClickElement {
2021-09-12T15:17:19.371632900Z [1631459839.371][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE ClickElement

# ... 3 minutes idle here

2021-09-12T15:20:16.939890600Z [1631460016.940][INFO]: [5f7edbcf654052d2d27f6204ab032605] COMMAND Quit {
2021-09-12T15:20:16.990369600Z [1631460016.990][INFO]: [5f7edbcf654052d2d27f6204ab032605] RESPONSE Quit
Dor-bl commented 3 years ago

@vania-pooh thanks for clarifying how to filter the important stuff, but the 3 mins timeout you mentioned is probably my fault, I put a break point in the flow and wasn't aware log is written only when run finish. So this is not the issue

Dor-bl commented 2 years ago

@vania-pooh after the latest .NET RC release , all is back to normal w/o any issues. closing the issue