Skip to content

Open Browser fails if desired capabilities is a dict #1277

@ombre42

Description

@ombre42

This issue goes away if you revert to SeleniumLibrary 3.2.0

Steps to reproduce the issue

*** Settings ***
Library    SeleniumLibrary
*** Test Cases ***
Repro
    ${caps}    Create Dictionary    javascriptEnabled=${True}
    Open Browser    https://www.google.com    desired_capabilities=${caps}

Error messages and additional information

Starting test: SL-bug.DesiredCapabilitiesBug.Repro
20190102 14:57:16.375 : TRACE : Arguments: [ 'javascriptEnabled=${True}' ]
20190102 14:57:16.376 : TRACE : Return: {'javascriptEnabled': True}
20190102 14:57:16.376 : INFO : ${caps} = {u'javascriptEnabled': True}
20190102 14:57:16.377 : TRACE : Arguments: [ 'https://www.google.com' | desired_capabilities={'javascriptEnabled': True} ]
20190102 14:57:16.377 : INFO : Opening browser 'firefox' to base url 'https://www.google.com'.
20190102 14:57:16.379 : TRACE : Arguments: [  ]
20190102 14:57:16.380 : INFO : Cannot capture screenshot because no browser is open.
20190102 14:57:16.380 : TRACE : Return: None
20190102 14:57:16.382 : FAIL : TypeError: __init__() got an unexpected keyword argument 'javascriptEnabled'
20190102 14:57:16.382 : DEBUG : Traceback (most recent call last):
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/__init__.py", line 372, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/base/robotlibcore.py", line 102, in run_keyword
    return self.keywords[name](*args, **kwargs)
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/keywords/browsermanagement.py", line 131, in open_browser
    ff_profile_dir, remote_url)
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/keywords/browsermanagement.py", line 456, in _make_driver
    remote_url=remote, profile_dir=profile_dir)
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/keywords/webdrivertools.py", line 58, in create_driver
    profile_dir)
  File "/ws/SL-bug/venv/lib/python2.7/site-packages/SeleniumLibrary/keywords/webdrivertools.py", line 109, in create_firefox
    **desired_capabilities)
Ending test: SL-bug.DesiredCapabilitiesBug.Repro

Expected behavior and actual behavior

When I follow those steps, keyword fails

I was expecting browser to open

Environment

Browser: Any
Browser driver: Any
Operating System: macOS 10.13.2
Libraries

  • Robot Framework: 3.1
  • Selenium: 3.141.0
  • SeleniumLibrary: 3.3.0
  • Interpreter: CPython 2.7.15

This was be caused by 159206f#diff-566132cdf5a534d7e99598e5acc77378. _parse_capabilities returns the capabilities as is when they are dict. But it needs to return keyword args as it does for string type desired capabilities or Falsey desired capabilities.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions