Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use selenium select class #68

Merged
merged 4 commits into from
Oct 5, 2012

Conversation

emanlove
Copy link
Member

Switch over to using Selenium's Select() class instead of duplicating code within robotframework-selenium2library.

@emanlove
Copy link
Member Author

@j1z0 or @rtomac : Could either of you review this? I prefer to have a pair of second eyes look over it and someone else merge my work.

@j1z0
Copy link
Contributor

j1z0 commented Jul 1, 2012

@emanlove

Looks good! A couple of comments though...
First let me qualify that when using "standard" webdriver I don't see any issues with this code. But I'm concerned about performance when using the remote webdriver. It has been my experience that when using the remote webdriver you want to reduce the number of calls to webdriver as each call incurs a round trip costs, and if (like me) your using something like SauceLabs (in the US) from a server in Belgium, that round trip cost can be significant. So at least from that point of view...

  1. get_selected_list_value and get_selected_list_label both traverse the entire list, even if the selected value / label you want is the first item. Which means the minimum number of round trips is the length of the list. I would prefer for this to use the webdriver.first_selected_option() instead of the webdriver.all_selected_options() as I believe that should be more performant.
  2. This is also somewhat of a change in functionality request driven by a desire for higher performance. The function unselect_from_list does a whole lot of work (webdriver calls) so the user can pass in the visible text or the value and then it unselects everything via index. However the function 'select_from_list' only works on visible text. Thus why not make unselecte_from_list also only work on visible text and then you just have to call webdriver.deselect_by_visible_text() we could then add additional functions for select / unselect by index and select / unselect by value. This would also mirror the webdriver API, which as discussed in previous issues, may make it harder for selenium 1 users to upgrade / update but IMHO is a better way moving forward...

what do you think?

@emanlove
Copy link
Member Author

emanlove commented Jul 1, 2012

@emanlove

Looks good! A couple of comments though...
First let me qualify that when using "standard" webdriver I don't see any issues with this code. But I'm concerned about performance when using the remote webdriver. It has been my experience that when using the remote webdriver you want to reduce the number of calls to webdriver as each call incurs a round trip costs, and if (like me) your using something like SauceLabs (in the US) from a server in Belgium, that round trip cost can be significant. So at least from that point of view...

  1. get_selected_list_value and get_selected_list_label both traverse the entire list, even if the selected value / label you want is the first item. Which means the minimum number of round trips is the length of the list. I would prefer for this to use the webdriver.first_selected_option() instead of the webdriver.all_selected_options() as I believe that should be more performant.
  2. This is also somewhat of a change in functionality request driven by a desire for higher performance. The function unselect_from_list does a whole lot of work (webdriver calls) so the user can pass in the visible text or the value and then it unselects everything via index. However the function 'select_from_list' only works on visible text. Thus why not make unselecte_from_list also only work on visible text and then you just have to call webdriver.deselect_by_visible_text() we could then add additional functions for select / unselect by index and select / unselect by value. This would also mirror the webdriver API, which as discussed in previous issues, may make it harder for selenium 1 users to upgrade / update but IMHO is a better way moving forward...

what do you think?

@j1z0,

I think you have made some real good points about performance; don't
merge yet as I will take a look at these issues.

Ed

schminitz and others added 2 commits September 3, 2012 13:14
Create new functions select_from_list_by_index, select_from_list_by_value, select_from_list_by_label.
Create new functions unselect_from_list_by_index, unselect_from_list_by_value, unselect_from_list_by_label.
Those are faster than original select_from_list and unselect_from_list.
@emanlove
Copy link
Member Author

@j1z0: Could you relook at these recent changes by @schminitz as I think they might address some of your concerns with performance. Thanks!

emanlove added a commit that referenced this pull request Oct 5, 2012
@emanlove emanlove merged commit 33040d0 into robotframework:master Oct 5, 2012
@emanlove emanlove deleted the use-selenium-select-class branch November 5, 2013 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants