Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged

New issue 8240 by 3...@detfalskested.dk: Make calling WebElement
manipulation methods chainable
https://code.google.com/p/selenium/issues/detail?id=8240

This is a feature request.

An example: If I want to change the text of an input field, i first have to
clear it, then enter the new text. For this, I either need to assign the
element to a variable to call .clear() and .send_keys() on it, or find the
element twice.

click, submit, clear, send_keys (possibly others?) have no return values.
I'd like them to return self, to allow me to optimise my example from
something like:

my_element.clear()
my_element.send_keys('new text')

To:

my_element.clear().send_keys('new_text')

Are there good arguments against this behaviour?

If not, I could even implement this myself (and push the code back to you),
but only for some of the supported languages, as I don't feel confident
with all of them.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-developer-activity@googlegroups.com.
Visit this group at http://groups.google.com/group/selenium-developer-activity.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Selenium at Dec 4, 2014 at 6:39 pm
    Updates:
      Cc: luke.semerau david.bu...@theautomatedtester.co.uk
      Labels: Lang-Python

    Comment #1 on issue 8240 by barancev: Make calling WebElement manipulation
    methods chainable
    https://code.google.com/p/selenium/issues/detail?id=8240

    (No comment was entered for this change.)

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity.
    For more options, visit https://groups.google.com/d/optout.
  • Selenium at Dec 4, 2014 at 9:30 pm
    Updates:
      Status: WontFix

    Comment #2 on issue 8240 by david.bu...@theautomatedtester.co.uk: Make
    calling WebElement manipulation methods chainable
    https://code.google.com/p/selenium/issues/detail?id=8240

    I am opposed to making APIs like this because it is a micro optimization to
    the API. If people start chaining it makes debugging code harder because if
    you have

    myelement.clear()\
               .send_keys("i heart cheese")

    and you want to debug an issue that is manifesting on send_keys() you would
    need to do all the steps before hand.

    Since we recommend that people use page object patterns for writing their
    tests, having to write a variable name a few times isn't going to really
    slow you down since editors can auto-complete it.

    --
    You received this message because this project is configured to send all
    issue notifications to this address.
    You may adjust your notification preferences at:
    https://code.google.com/hosting/settings

    --
    You received this message because you are subscribed to the Google Groups "Selenium Developer Activity" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to selenium-developer-activity+unsubscribe@googlegroups.com.
    To post to this group, send email to selenium-developer-activity@googlegroups.com.
    Visit this group at http://groups.google.com/group/selenium-developer-activity.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-developer-activity @
categoriesselenium
postedDec 2, '14 at 11:42a
activeDec 4, '14 at 9:30p
posts3
users1
websiteseleniumhq.org

1 user in discussion

Selenium: 3 posts

People

Translate

site design / logo © 2021 Grokbase