Skip to content
12 changes: 12 additions & 0 deletions BUILD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ To run just the unit tests, run::
python test/run_unit_tests.py


Debugging Selenium2Library
--------------------------

In the course of debugging the Selenium2Library one might need to set a
breakpoint using `pdb`_. Since Robot Framework hijacks the console output
one should use the folowing code to redirect output back to stdout for
debugging purposes.

import pdb,sys; pdb.Pdb(stdout=sys.__stdout__).set_trace()


Testing Third-Party Packages
----------------------------

Expand Down Expand Up @@ -276,6 +287,7 @@ are parsed by the reStructuredText parser. To build them, run::
python doc/generate_readmes.py


.. _pdb: http://docs.python.org/2/library/pdb.html
.. _downloads section on GitHub: https://github.com/rtomac/robotframework-selenium2library/downloads
.. _PyPI: http://pypi.python.org
.. _.pypirc file: http://docs.python.org/distutils/packageindex.html#the-pypirc-file
Expand Down
16 changes: 15 additions & 1 deletion src/Selenium2Library/keywords/_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def press_key(self, locator, key):
"""Simulates user pressing key on element identified by `locator`.

`key` is either a single character, or a numerical ASCII code of the key
lead by '\\'. In test data, '\\' must be escaped, so use '\\\\'.
lead by '\\\\'.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have this conflict. Not sure which wording you prefer. My thoughts is that if it always has to be escaped there is not point in saying otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just touched that Press Key documentation and code (it was missing
from an old PR).
With the new Press KeyS keyword we can use named keys instead of escaped
key codes.

On Tue, May 19, 2015 at 2:09 PM, Ed Manlove [email protected]
wrote:

In src/Selenium2Library/keywords/_element.py
#264 (comment)
:

@@ -480,7 +480,7 @@ def press_key(self, locator, key):
"""Simulates user pressing key on element identified by locator.

     `key` is either a single character, or a numerical ASCII code of the key
  •    lead by '\'. In test data, '\' must be escaped, so use '\\'.
    
  •    lead by '\\'.
    

I did have this conflict. Not sure which wording you prefer. My thoughts
is that if it always has to be escaped there is not point in saying
otherwise.


Reply to this email directly or view it on GitHub
https://github.com/rtomac/robotframework-selenium2library/pull/264/files#r30596483
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with how you have it.


Examples:
| Press Key | text_field | q |
Expand Down Expand Up @@ -598,6 +598,13 @@ def page_should_not_contain_image(self, locator, message='', loglevel='INFO'):
def get_matching_xpath_count(self, xpath):
"""Returns number of elements matching `xpath`

One should not use the xpath= prefix for 'xpath'. XPath is assumed.

Correct:
| count = | Get Matching Xpath Count | //div[@id='sales-pop']
Incorrect:
| count = | Get Matching Xpath Count | xpath=//div[@id='sales-pop']

If you wish to assert the number of matching elements, use
`Xpath Should Match X Times`.
"""
Expand All @@ -607,6 +614,13 @@ def get_matching_xpath_count(self, xpath):
def xpath_should_match_x_times(self, xpath, expected_xpath_count, message='', loglevel='INFO'):
"""Verifies that the page contains the given number of elements located by the given `xpath`.

One should not use the xpath= prefix for 'xpath'. XPath is assumed.

Correct:
| Xpath Should Match X Times | //div[@id='sales-pop'] | 1
Incorrect:
| Xpath Should Match X Times | xpath=//div[@id='sales-pop'] | 1

See `Page Should Contain Element` for explanation about `message` and
`loglevel` arguments.
"""
Expand Down