Skip to content

Browser Capabilities handling : need to fix boolean values for remote webdriver - need to use capabilities for local webdriver #342

Closed

Description

@tramora

Hi all,
On a webapp I have to use a popup only shown on mouse hover.

For this purpose I need to give the requireMouseFocus parameter in the capabilities for Internet Explorer. This works well in pure python/selenium.

Unfortunately when using robot and selenium2library (1.5.0) it makes the IEDriverServer.exe (2.43.0) crash violently

Boolean capabilities parsing

I found that the parsing in Selenium2Library::_BrowserManagementKeywords (_browsermanagement.py) needs a fix. Indeed boolean values are taken as string. My code fix suggestion is the following in _parse_capabilities_string :

for cap in capabilities_string.split(","):
            (key, value) = cap.split(":", 1)
            #TR
            if value.strip().lower() == "true":
               desired_capabilities[key.strip()] = True
            elif value.strip().lower() == "false":
               desired_capabilities[key.strip()] = False
            else:  
               desired_capabilities[key.strip()] = value.strip()
            #TR

Capabilities not taken into account for local use (related to Issue #139)

Unfortunatly this fix is not enough for local webdriver as capabilities are totally ignored then. To fix this I suggest also this fix in _generic_make_browser :

if not remote_url:
            #TR
            merged_caps = desired_cap_type.copy()
            merged_caps.update(self._parse_capabilities_string(desired_caps))
            browser = webdriver_type(capabilities=merged_caps)
            #TR

If you confirm the two issues, is it possible to plan the fixes for the next release ?

Thank you for your feedbacks
Thierry R.

Activity

  1. ombre42 commented on Oct 10, 2014

    @ombre42
    Contributor

    The issue with booleans interpreted as strings was addressed in 1.3. You can pass in a real dict instead of a specially formatted string.
    This is mentioned in the doc for Open Browser:

    'desired_capabilities' can also be a dictonary (created with 'Create Dictionary') to allow for more complex configurations.
    

    Hmmm... I think that could be improved by mentioning how it differs from when the argument is a string.

    #139 is tagged future release. I'm not sure when it will get fixed, but it should be.

    I think your best option is to use Create Webdriver.
    There is an example there demonstrating how to pass arguments to the __init__ of IE's webdriver.

    The solution to #139 isn't quite that simple. Some of the webdrivers have a capabilities argument and others have desired_capabilities.
    There is some info and history in #245.

  2. tramora commented on Oct 13, 2014

    @tramora
    Author

    Hi Kevin,
    Thank you for your answer and the proposed workaround for the booleans (Create dictionary). However I think it's is better to fix also the code so that the behaviour is the same when using a string and a real dictionary.
    Ok for #139. Create Webdriver is an usable workaround before an acceptable way to fix the code is found.

  3. ombre42 commented on Oct 13, 2014

    @ombre42
    Contributor

    There are other issues too...
    proxy's value is a dict - this has been a problem for a lot of people and fixing that is not as simple as the bool issue.
    int-type capabilities are being sent as strings - I'm assuming that is no good either.

    We gladly accept patches with tests if you want to improve the string parsing.

  4. aaltat commented on May 23, 2016

    @aaltat
    Contributor

    There has not been activity for this issue for long time and we are planning to close the old issues if they are not anymore valid ones. If you feel that this is still valid issue, could you send an update. If update is not received in a month, we will assume that this is not anymore an issues and we will close this issue.

  5. aaltat commented on Sep 19, 2017

    @aaltat
    Contributor

    Closing due inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions