Closed benzman81 closed 6 years ago
@benzman81 euh, Selenoid does not return such error: Unable to find a matching set of capabilities
. You capability seems to be correct. Is it C# or Java?
You can also try this approach: https://aerokube.com/selenoid/latest/#_specifying_capabilities_via_protocol_extensions
@vania-pooh its java
and its behind a ggr if that matters
Tried it now like this:
Map<String, Object> opt = new HashMap<>();
// opt.put("screenResolution", "1280x1024x24");
opt.put("env", new String[]{"LANG=de_DE.UTF-8", "LANGUAGE=de:den", "LC_ALL=de_DE.UTF-8"});
capabilities.setCapability("selenoid:options", opt);
I don't get an error now, but the browser is still displaying everything in english. Setting the screen resolution works as expected.
@benzman81 What is your Selenoid version? Please check whether it works with Chrome.
@vania-pooh chrome and ff do not set the language as expected with these settings.
We use the following images for our grid:
aaerokube/selenoid:1.6.2
aerokube/selenoid-ui:1.6.1
aerokube/ggr:1.5.5
aerokube/ggr-ui:1.1.1
Our browser json:
{
"chrome": {
"default": "67.0",
"versions": {
"67.0": {
"image": "selenoid/vnc:chrome_67.0",
"port": "4444",
"path": "/"
}
}
},
"firefox": {
"default": "60.0",
"versions": {
"60.0": {
"image": "selenoid/vnc:firefox_60.0",
"port": "4444",
"path": "/wd/hub"
}
}
}
}
@benzman81 could you set a breakpoint and check with docker inspect <container-id>
that respective environment variables are set on browser container? I think variables are applied but language is not updated.
@vania-pooh result is added as file per browser, but I couldnt see the "LANG" settings. ff.txt chrome.txt
@benzman81 just tried myself. Works like a charm with two notations. One with an array of strings:
caps.setCapability("env", new String[]{"LANG=de_DE.UTF-8", "LANGUAGE=de:den", "LC_ALL=de_DE.UTF-8"});
Another one with ArrayList
:
caps.setCapability("env", new ArrayList<String>(){
{
add("LANG=de_DE.UTF-8");
add("LANGUAGE=de:den");
add("LC_ALL=de_DE.UTF-8");
}
});
My Selenium Java client version is 3.8.0
.
@vania-pooh ok, now more testing:
Using "selenoid:options" the language is not set for the browser but tests run of course failing to find text with correct locale.
Using "env" fully works with chrome (just tested ff before with this option) and tests run fine. But with firefox I still get the error:
org.openqa.selenium.WebDriverException: cannot create session firefox-60.0 on any hosts after 1 attempt(s), last host error was: Unable to find a matching set of capabilities
Our Selenium Java version is 3.8.1.
@benzman81 yes, does not work with Firefox. At least there is a bug with processing selenoid:options
. Let's fix this and see whether it helps.
@benzman81 should now work with aerokube/selenoid:latest
. Only the 4th attempt to implement this was successful.
Hi,
same problem here, still with the firefox images currently provided on Docker Hub. I have tried almost every version image between 3.6 and 106.0. By the way, the current "latest" Firefox image doesn't want to start at all, not even from within Selenoid UI.
When I request the most recent Firefox version image like that:
curl \
-H "Content-Type: application/json" \
-X POST 'http://localhost:4444/wd/hub/session' \
-d '{
"desiredCapabilities": {
"browserName": "firefox",
"version": "106.0",
"selenoid:options": {
"enableVNC": true,
"env": [
"LANG=de_DE.UTF-8",
"LANGUAGE=de:den",
"LC_ALL=de_DE.UTF-8"
],
"sessionTimeout": "120s"
}
},
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"browserVersion": "106.0",
"selenoid:options": {
"enableVNC": true,
"env": [
"LANG=de_DE.UTF-8",
"LANGUAGE=de:den",
"LC_ALL=de_DE.UTF-8"
],
"sessionTimeout": "120s"
}
},
"firstMatch": [
{}
]
}
}'
... I get the Firefox UI with Englisch localization.
Same applies, when using a shorter env-config simply for German localization like "env": [ "LANG=de_DE.UTF-8" ]
.
In contrast, for Chrome and also Safari, both work. Moreover, for Chrome even "env": [ "LANG=de_DE" ]
works.
So am I doing something wrong for Firefox or has the bug wormed its way into the Firefox images again?
@drundanibel Firefox simply does not use this env variable. Instead you may need to set Firefox prefs explicitly:
FirefoxOptions options = new FirefoxOptions();
options.addPreference("intl.accept_languages", "de");
Thanks a lot, @vania-pooh! Since I needed the raw JSON string, I had to try out a few things, but this is how it actually works for me:
curl \
-H "Content-Type: application/json" \
-X POST 'http://localhost:4444/wd/hub/session' \
-d '{
"desiredCapabilities": {
"browserName": "firefox",
"version": "106.0",
"moz:firefoxOptions": {
"prefs": {
"intl.accept_languages": "de"
}
},
"selenoid:options": {
"enableVNC": true,
"sessionTimeout": "120s"
}
},
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"browserVersion": "106.0",
"moz:firefoxOptions": {
"prefs": {
"intl.accept_languages": "de"
}
},
"selenoid:options": {
"enableVNC": true,
"sessionTimeout": "120s"
}
},
"firstMatch": [
{}
]
}
}'
@drundanibel yes, firefox prefs live under moz:firefoxOptions
.
Hi,
until now we use selenoid images (chrome/ff) to test our webapp with locale EN. Now we also want to test it with locale DE. Your documentation states, that I can do this by passing a capability "env.
Adding the line
capabilities.setCapability("env", new String[]{"LANG=de_DE.UTF-8", "LANGUAGE=de:den", "LC_ALL=de_DE.UTF-8"});
to our code, we receive the following error:org.openqa.selenium.WebDriverException: cannot create session firefox-60.0 on any hosts after 1 attempt(s), last host error was: Unable to find a matching set of capabilities
Are we missing something here?
Regards, Markus