Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ability to select browser and version for selenoid через capability #1190

Answered by mdmintz
Morojko asked this question in Q&A
Discussion options

Hello!
It is not possible to launch a specific browser and version in selenoid

When choosing to launch via --browser=remote, the parameters browserName, browserVersion do not lend themselves to capability.
You need to specify the browser opera, chrome, firefox and versions for them
Or am I doing something wrong? Thanks!

example capability:

config['capabilities'] = {
 "browserName": "chrome",
 "browserVersion": "96.0",
 "goog:chromeOptions": {
 "args": [
 "window-size=1920,1080"
 ]
 },
 "selenoid:options": {
 "enableVNC": True,
 "enableVideo": False,
 "enableLog": True,
 "screenResolution": screen_resolution,
 }
 }
You must be logged in to vote

Hello, the capabilities depend on the type of Selenium Grid being used. For some grids, the browser is specified inside capabilities, and for other grids (as well as non-grid tests) the browser is specified using --browser=BROWSER. The capabilities you have seem to match the format of a capabilities file (example: selenoid_cap_file.py) although if you are trying to specify an exact browser version, then the Grid would need to have that version installed. Otherwise it'll just use the version that it finds. More info on capabilities usage here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities

Replies: 1 comment 4 replies

Comment options

Hello, the capabilities depend on the type of Selenium Grid being used. For some grids, the browser is specified inside capabilities, and for other grids (as well as non-grid tests) the browser is specified using --browser=BROWSER. The capabilities you have seem to match the format of a capabilities file (example: selenoid_cap_file.py) although if you are trying to specify an exact browser version, then the Grid would need to have that version installed. Otherwise it'll just use the version that it finds. More info on capabilities usage here: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities

You must be logged in to vote
4 replies
Comment options

Version selection only works for chrome. It would be desirable that for remote it was also possible to forward the version and the browser. Although you can opera and firefox

remote, opera:

elif browser_name == constants.Browser.REMOTE:
 selenoid = False
 selenoid_options = None
 screen_resolution = None
 for key in desired_caps.keys():
 if key == "selenoid:options":
 selenoid = True
 selenoid_options = desired_caps[key]
 elif key == "screenResolution":
 screen_resolution = desired_caps[key]
 if selenium4:
 remote_options = ArgOptions()
 remote_options.set_capability("cloud:options", desired_caps)
 if selenoid:
 snops = selenoid_options
 remote_options.set_capability("selenoid:options", snops)
 if screen_resolution:
 scres = screen_resolution
 remote_options.set_capability("screenResolution", scres)
 return webdriver.Remote(
 command_executor=address,
 options=remote_options,
 keep_alive=True,
 )

Chrome:

 for key in desired_caps.keys():
 capabilities[key] = desired_caps[key]
 if key == "selenoid:options":
 selenoid = True
 selenoid_options = desired_caps[key]
 elif key == "screenResolution":
 screen_resolution = desired_caps[key]
 elif key == "version" or key == "browserVersion":
 browser_version = desired_caps[key]
 elif key == "platform" or key == "platformName":
 platform_name = desired_caps[key]
 if selenium4:
 chrome_options.set_capability("cloud:options", capabilities)
 if selenoid:
 snops = selenoid_options
 chrome_options.set_capability("selenoid:options", snops)
 if screen_resolution:
 scres = screen_resolution
 chrome_options.set_capability("screenResolution", scres)
 if browser_version:
 br_vers = browser_version
 chrome_options.set_capability("browserVersion", br_vers)
 if platform_name:
 plat_name = platform_name
 chrome_options.set_capability("platformName", plat_name)
 return webdriver.Remote(
 command_executor=address,
 options=chrome_options,
 keep_alive=True,
 )
Comment options

I see the issue. I'll try to ship a new release on Monday.

Comment options

thanks!

Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /