MarkusBernhardt / robotframework-selenium2library-java

Java port of the Selenium 2 (WebDriver) Python library for Robot Framework
Apache License 2.0
46 stars 48 forks source link

Fix for issue #12 #15

Closed Hi-Fi closed 11 years ago

Hi-Fi commented 11 years ago

Compared code with Python version, there was an error how keyword is handled if no values given.

Also added some comments to that, and new integration test that checks selection of value from (onChange()) dropdown.

MarkusBernhardt commented 11 years ago

I'm at the moment really stumbled, what your change does.

if (items.length != 0) {

and

if (items.length < 1) {

should do exactly the same. items is a array and length therefor from 0 to n.

What am I missing?

Hi-Fi commented 11 years ago

Point is, that all values should be selected within the if clause only, if user doesn't give any items to select (so, when list length is 0).

In python code same:

if not items:
            for i in range(len(select.options)):
                select.select_by_index(i)
            return

Old code wen to clause, if list wasn't empty, which was wrong, and which is handled in code after the if-clause.

MarkusBernhardt commented 11 years ago

OMG!

if (items.length != 0) {

is not the same as

if (items.length < 1) {

but

if (items.length == 0) {

Thanks for that catch!

Hi-Fi commented 11 years ago

That also has quite a big impact to performance, especially if long lists are used (one reason, that I last time moved back to Python version).