robotframework / OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Apache License 2.0
13 stars 3 forks source link

`Get Horizontal Position` and `Get Vertical Position` -keywords #77

Closed spooning closed 9 years ago

spooning commented 9 years ago

Originally submitted to Google Code by @pekkaklarck on 22 Jan 2010

The basic implementation is trivial using Selenium Python APIs methods get_element_position_left and get_element_position_right. There are, however, at least two open questions:

1) If these methods cannot get the position they return an empty string. We noticed this when trying to use them with elements of an advanced map component. Notice that in these cases the elements were found, using these methods when the element doesn't exists at all results to an error. The question is, should our keyword fail if there's no valid return value? In my opinion it should.

2) Should the value be returned as number or string? Converting to a number would also make it sure the return value is valid, but I'd still check the empty string specially. I assume the position is returned as full pixels and thus converting to integer would be OK.

spooning commented 9 years ago

Originally submitted to Google Code by ana.r... on 22 Jan 2010

Please also add the

def get_element_attribute(self,attributeLocator): return self._selenium.get_attribute(attributeLocator)

that we tested with success, when testing the panning on the same advanced map. We could only test that the panning was successfully performed, by looking at positions attributes of the map.

spooning commented 9 years ago

Originally submitted to Google Code by @pekkaklarck on 24 Jan 2010

Get Element Attribute requires a separate issue.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 9 Feb 2010

Actually the methods of selenium API are get_element_position_left and get_element_position_top, where left returns horizontal position and top return vertical position.

In my opinion, these keywords are best named Get Vertical Position and Get Horizontal Position.

For me it is fine to fail if no numerical value can be resolved.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 9 Feb 2010

Added Get Horizontal Position in r316

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 9 Feb 2010

Added Get Vertical Position in r318.

Docs should be proofread, and somebody might want to comment the chosen keyword names

spooning commented 9 years ago

Originally submitted to Google Code by @pekkaklarck on 9 Feb 2010

I like the new keyword names. I also did some smallish doc enhancements in r323.

Janne, is there a reason the _get_position helper doesn't also check was something returned and convert the value to an integer? It seems to me that get_horizontal/vertical_position methods could be one-liners and all the work be done in _get_position.

spooning commented 9 years ago

Originally submitted to Google Code by @yanne on 10 Feb 2010

Just an oversight. Refactored in r337. I think this is now Done.