Skip to content

Documentation error for desription of "Using webelement" #469

Closed

Description

@tarand

The keyword documentation has:
Starting with version 1.7 of the Selenium2Library, one can pass an argument that contains a WebElement instead of a string locator. To get a WebElement, use the new Get WebElements keyword. For example:
${elem} = Get WebElements id=my_element
Click Element ${elem}

This can obviously not work, as Get WebElements returns a list. I think it should be
${elements} = Get WebElements id=my_element
Click Element ${elements}.first()
Or similar

Activity

  1. just-be-dev commented on Jul 27, 2015

    @just-be-dev
    Contributor

    Ugh, yeah, you're right. We'd planned on adding a Get WebElement keyword that just returned a single item. That slipped through the cracks though.

    I'll look at rewording the documentation and possibly introducing that keyword.

  2. just-be-dev commented on Jul 28, 2015

    @just-be-dev
    Contributor

    Should I add Get WebElementor just suggest people use Get WebElements combined with @{list}[0]?

  3. just-be-dev commented on Jul 28, 2015

    @just-be-dev
    Contributor

    @pekkaklarck, is there any precedence for this? Having two keywords, one that returns a list of items and the other that returns just the first.

  4. pekkaklarck commented on Jul 28, 2015

    @pekkaklarck
    Member

    I think it would be convenient to have Get WebElement separately.

    For example, XML library has both Get Elements and Get Element keywords. The former returns a list of elements and the list can be empty. The latter fails if there is not exactly one element. Would that make sense in S2L context?

  5. tarand commented on Jul 28, 2015

    @tarand
    Author

    I would say, yes.

    Thomas


    Thomas Arand
    Tel. +49 (89) 5159 36328 / +49 (160) 90888023
    thomas.arand@nokia.commailto:thomas.arand@nsn.com

    Nokia Solutions and Networks Deutschland GmbH

    From: ext Pekka Klärck [mailto:notifications@github.com]
    Sent: Tuesday, July 28, 2015 8:16 AM
    To: rtomac/robotframework-selenium2library
    Cc: Arand, Thomas (Nokia - DE/Munich)
    Subject: Re: [robotframework-selenium2library] Documentation error for desription of "Using webelement" (#469)

    I think it would be convenient to have Get WebElement separately.

    For example, XML library has both Get Elements and Get Element keywords. The former returns a list of elements and the list can be empty. The latter fails if there is not exactly one element. Would that make sense in S2L context?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/469#issuecomment-125464010.

  6. just-be-dev commented on Jul 28, 2015

    @just-be-dev
    Contributor

    I thought it was needed originally, and I still think it'd be nice to have.

  7. just-be-dev commented on Aug 14, 2015

    @just-be-dev
    Contributor

    Fixed in 1.7.3

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