Get Cookies keyword will fail if the Selenium get_cookie method return value contains more keys than: name, value, path, domain, secure, httpOnly and expiry
See original GitHub issueSelenium get_cookie returns a dictionary. If the dictionary contains more keys then the name
, value
, path
, domain
, secure
, httpOnly
and expiry
, then the Get Cookies keyword will fail:
20190212 16:54:43.113 : FAIL : TypeError: __init__() got an unexpected keyword argument 'hCode'
20190212 16:54:43.113 : DEBUG :
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\SeleniumLibrary\__init__.py", line 369, in run_keyword
return DynamicCore.run_keyword(self, name, args, kwargs)
File "C:\Python27\lib\site-packages\SeleniumLibrary\base\robotlibcore.py", line 102, in run_keyword
return self.keywords[name](*args, **kwargs)
File "C:\Python27\lib\site-packages\SeleniumLibrary\keywords\cookie.py", line 99, in get_cookie
return CookieInformation(**cookie)
This is because the Get Cookies keywords has hard coded keys what Selenium response can contain in the CookieInformation object. The limitation has been in place since the SeleniumLibrary 3.0 release, but there was issue reported in Slack, that for that particular user, Selenium get_cookie
did return the following:
{u'domain': u'1.2.3.4', u'name': u'components_state', u'value': u'alsdjaslkdjasdlkj', u'path': u'/', u'hCode': -1693023704, u'class': u'org.openqa.selenium.Cookie', u'httpOnly': False, u'secure': False}
SeleniumLibrary should not fail, if the Selenium get_cookie
returns more keys that is specified . Instead we should allow extra keys to be passed to the CookieInformation
object and allow access to the extra keys in similar way as the specified keys.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@vyvital this issue should be fixed. Could you install from master and give it a try?
Ah, very good point, will make the changes.