diff --git a/BUILD.rst b/BUILD.rst index dbb95f65f..497e74a48 100644 --- a/BUILD.rst +++ b/BUILD.rst @@ -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 ---------------------------- @@ -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 diff --git a/src/Selenium2Library/keywords/_element.py b/src/Selenium2Library/keywords/_element.py index 3117e7d1d..69dfd3b10 100644 --- a/src/Selenium2Library/keywords/_element.py +++ b/src/Selenium2Library/keywords/_element.py @@ -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 '\\\\'. Examples: | Press Key | text_field | q | @@ -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`. """ @@ -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. """