aerokube / ggr

A lightweight load balancer used to create big Selenium clusters
https://aerokube.com/ggr/latest/
Apache License 2.0
314 stars 74 forks source link

Unable to execute test cases after upgrading to selenium 4.0 #346

Closed aryanm12 closed 3 years ago

aryanm12 commented 3 years ago

Hi @aerokube Team,

We have recently upgraded the selenium version to 4.0. After this, the test cases are failing with the below-mentioned error:

System.ArgumentException : elementDictionary (Parameter 'The specified dictionary does not contain an element reference')
Stack Trace:
WebElementFactory.GetElementId(Dictionary`2 elementDictionary)
WebElementFactory.CreateElement(Dictionary`2 elementDictionary)
WebDriver.GetElementFromResponse(Response response)
WebDriver.FindElement(String mechanism, String value)
<.ctor>b__11_0(ISearchContext context)
By.FindElement(ISearchContext context)
WebDriver.FindElement(By by)
<>c__DisplayClass6_0.<ElementExists>b__0(IWebDriver driver)
DefaultWait`1.Until[TResult](Func`2 condition, CancellationToken token)
DefaultWait`1.Until[TResult](Func`2 condition)
<17 more frames...>
UniversalBrowserElement.IsVisible()
LoggingElement.IsVisible()
WebPageElement.IsVisible()
Wait.WaitFor(Int32 millisecondsTotalToWait, Func`1 conditionToWaitFor, Func`1 unlessConditionToWaitFor, Func`1 unlessElementConditionToWaitFor)
TryInspectElement.WaitHelper(For timeToWait, Func`1 conditionToWaitFor, BasePageObject unlessPage, IWebPageElement unlessElement)
TryInspectElement.ToBeVisible(For timeToWait, BasePageObject unlessPage, IWebPageElement unlessElement)

Also, we checked the ggr container logs and found below errors as attached:

MicrosoftTeams-image

We ran the test cases in our local system by directly pointing to the selenoid node and skipping the ggr router, and the test cases are running fine with this setting. Also, they are running fine locally.

Version of containers used in GGR router:

Version of containers used in selenoid nodes:

Can you please look into it and help us resolve this issue.

vania-pooh commented 3 years ago

Related to #314. Only reproduces with client libraries that are using firstMatch.

aryanm12 commented 3 years ago

Related to #314. Only reproduces with client libraries that are using firstMatch.

Could you please let us know, when can we expect this feature to be added/released. As we really need to move to selenium 4 as per our work demand.

vania-pooh commented 3 years ago

@aryanm12 this is open-source. If you wish this implemented faster - you could contribute.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

SaveliyShur commented 2 years ago

I have the same problem, may be who solved?

vania-pooh commented 2 years ago

@SaveliyShur this was implemented in latest release. However there is: https://github.com/aerokube/ggr/issues/354

SaveliyShur commented 2 years ago

@SaveliyShur this was implemented in latest release. However there is: #354

I see in docker logs: image I have last version ggr and selenoid docker image. And I use C# with Selenium 4.1.0. I configure remoteWebDriver with:

var options = new ChromeOptions();
foreach (var opt in settings.BrowserApplicationSettings.Options)
            {
                options.AddArguments(opt);
            }
options.AddUserProfilePreference("profile.default_content_setting_values.popups", 1);
options.AddUserProfilePreference("profile.default_content_setting_values.clipboard", 1);
options.AddUserProfilePreference("profile.default_content_setting_values.notifications", 2);
options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
options.SetLoggingPreference(LogType.Driver, LogLevel.All);
options.SetLoggingPreference("performance", LogLevel.All);
options.AddAdditionalCapability("sessionTimeout", "10m", true);
options.AddAdditionalCapability("enableVNC", true, true);
options.AddAdditionalCapability("screenResolution", "640x1024", true);
options.AddAdditionalCapability("name", this.scenarioContext.ScenarioInfo.Title, true);
var capabilities = options.ToCapabilities();
var selenoidUrl = new Uri(settings.SelenoidUrl);
var httpCommandExecutor = new HttpCommandExecutor(selenoidUrl, this.browserCommandTimeoutInSec, true);

using (httpCommandExecutor)
    {
        this.DesktopDriver = new RemoteWebDriver(httpCommandExecutor, capabilities)
        {
            FileDetector = new LocalFileDetector(),
        };

        var commandInfo = new HttpCommandInfo(HttpCommandInfo.PostCommand, "/session/{sessionId}/se/log");
        httpCommandExecutor.TryAddCommand(DriverCommand.GetLog, commandInfo);
}

I try configure with BrowserVersion And other settings but i cannon set browser at all. My Selenoid configure: image

I try with empty defaultVersion and version number, and try delete them. Can you help me some advice?

SaveliyShur commented 2 years ago

If i used Selenium < 4.0.0 - It's OK

vania-pooh commented 2 years ago

@SaveliyShur enableVNC and other Selenoid-specific capabilities should live under selenoid:options key.