diff --git a/.gitignore b/.gitignore index 56284b44b..6f7b23439 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ test/results *.pyc *.orig MANIFEST -doc/*.html *.egg-info *.egg chromedriver.log diff --git a/CHANGES.rst b/CHANGES.rst index e5fa6931d..c5c62f247 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,22 @@ Release Notes ============= +1.7.4 +------------------- +- Reverted 'Press Keys' because of backwards incompatible changes [zephraph] + +1.7.3 +------------------- +- Added 'Get WebElement' [zephraph][emanlove] + +- Added named keys to 'Press Key' [helioguilherme66] + +- Fix an import error that caused a dependence on RF >= 2.8.5 + [zephraph] + +- Fixed an issue that caused screenshots to be improperly linked in the logs + [zephraph] + 1.7.2 ---------------- - Added an argument called screenshot_root_directory that can be passed into S2L's diff --git a/README.rst b/README.rst index 52ce57f19..1a2cf50df 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,9 @@ Selenium 2 (WebDriver) library for Robot Framework .. image:: https://img.shields.io/pypi/l/robotframework-selenium2library.svg :target: http://www.apache.org/licenses/LICENSE-2.0 + +.. image:: https://coveralls.io/repos/rtomac/robotframework-selenium2library/badge.svg?branch=master&service=github + :target: https://coveralls.io/github/rtomac/robotframework-selenium2library?branch=master .. image:: https://robotframework-slack.herokuapp.com/badge.svg :target: https://robotframework-slack.herokuapp.com diff --git a/doc/Selenium2Library.html b/doc/Selenium2Library.html new file mode 100644 index 000000000..c0c9a79fc --- /dev/null +++ b/doc/Selenium2Library.html @@ -0,0 +1,832 @@ + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+ +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Selenium2Library/__init__.py b/src/Selenium2Library/__init__.py index da5696fc1..3a481a883 100644 --- a/src/Selenium2Library/__init__.py +++ b/src/Selenium2Library/__init__.py @@ -33,7 +33,8 @@ class Selenium2Library( imported into your Robot test suite (see `importing` section), and the `Open Browser` keyword must be used to open a browser to the desired location. - **--- Note important change starting with Version 1.7.0 release ---** + + *--- Note important change starting with Version 1.7.0 release ---* = Locating or specifying elements = All keywords in Selenium2Library that need to find an element on the page @@ -42,14 +43,14 @@ class Selenium2Library( specifying different location strategies. `webelement` is a variable that holds a WebElement instance, which is a representation of the element. - Using 'locator' + *Using locators* --------------- By default, when a locator value is provided, it is matched against the key attributes of the particular element type. For example, `id` and `name` are key attributes to all elements, and locating elements is easy - using just the `id` as a `locator`. For example:: + using just the `id` as a `locator`. For example: - Click Element my_element + | Click Element my_element It is also possible to specify the approach Selenium2Library should take to find an element by specifying a lookup strategy with a locator @@ -76,14 +77,14 @@ class Selenium2Library( This can be fixed by changing the locator to: | Click Link default=page?a=b - Using 'webelement' + *Using webelements* ------------------ Starting with version 1.7 of the Selenium2Library, one can pass an argument that contains a WebElement instead of a string locator. To get a WebElement, use the new `Get WebElements` keyword. For example: - | ${elem} = | Get WebElements | id=my_element | - | Click Element | ${elem} | | + | ${elem} = | Get WebElement | id=my_element | + | Click Element | ${elem} | | Locating Tables, Table Rows, Columns, etc. ------------------------------------------ @@ -91,7 +92,7 @@ class Selenium2Library( By default, when a table locator value is provided, it will search for a table with the specified `id` attribute. For example: - Table Should Contain my_table text + | Table Should Contain my_table text More complex table lookup strategies are also supported: @@ -113,7 +114,7 @@ class Selenium2Library( to the WebDriver instance and `${criteria}` is the text of the locator (i.e. everything that comes after the = sign). To use this locator it must first be registered with `Add Location Strategy`. - Add Location Strategy custom Custom Locator Strategy + | Add Location Strategy custom Custom Locator Strategy The first argument of `Add Location Strategy` specifies the name of the lookup strategy (which must be unique). After registration of the lookup strategy, the usage is the same as other locators. See `Add Location Strategy` for more details. diff --git a/src/Selenium2Library/keywords/_browsermanagement.py b/src/Selenium2Library/keywords/_browsermanagement.py index e048d4431..775656fac 100644 --- a/src/Selenium2Library/keywords/_browsermanagement.py +++ b/src/Selenium2Library/keywords/_browsermanagement.py @@ -114,7 +114,7 @@ def open_browser(self, url, browser='firefox', alias=None,remote_url=False, browser = self._make_browser(browser_name,desired_capabilities,ff_profile_dir,remote_url) try: browser.get(url) - except: + except: self._cache.register(browser, alias) self._debug("Opened browser with session id %s but failed to open url '%s'" % (browser.session_id, url)) @@ -155,11 +155,11 @@ def create_webdriver(self, driver_name, alias=None, kwargs={}, **init_kwargs): | # use a proxy for PhantomJS | | | | | ${service args}= | Create List | --proxy=192.168.132.104:8888 | | | Create Webdriver | PhantomJS | service_args=${service args} | | - + Example for Robot Framework < 2.8: - | # debug IE driver | | | | | | - | ${kwargs}= | Create Dictionary | log_level | DEBUG | log_file | %{HOMEPATH}${/}ie.log | - | Create Webdriver | Ie | kwargs=${kwargs} | | | | + | # debug IE driver | | | | + | ${kwargs}= | Create Dictionary | log_level=DEBUG | log_file=%{HOMEPATH}${/}ie.log | + | Create Webdriver | Ie | kwargs=${kwargs} | | """ if not isinstance(kwargs, dict): raise RuntimeError("kwargs must be a dictionary.") @@ -291,13 +291,13 @@ def select_frame(self, locator): def select_window(self, locator=None): """Selects the window matching locator and return previous window handle. - + locator: any of name, title, url, window handle, excluded handle's list, or special words. return: either current window handle before selecting, or None if no current window. - + If the window is found, all subsequent commands use that window, until this keyword is used again. If the window is not found, this keyword fails. - + By default, when a locator value is provided, it is matched against the title of the window and the javascript name of the window. If multiple windows with @@ -476,26 +476,26 @@ def set_selenium_implicit_wait(self, seconds): """Sets Selenium 2's default implicit wait in seconds and sets the implicit wait for all open browsers. - From selenium 2 function 'Sets a sticky timeout to implicitly + From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.' Example: | ${orig wait} = | Set Selenium Implicit Wait | 10 seconds | | Perform AJAX call that is slow | - | Set Selenium Implicit Wait | ${orig wait} | + | Set Selenium Implicit Wait | ${orig wait} | """ old_wait = self.get_selenium_implicit_wait() self._implicit_wait_in_secs = robot.utils.timestr_to_secs(seconds) for browser in self._cache.get_open_browsers(): browser.implicitly_wait(self._implicit_wait_in_secs) return old_wait - + def set_browser_implicit_wait(self, seconds): """Sets current browser's implicit wait in seconds. - From selenium 2 function 'Sets a sticky timeout to implicitly + From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.' @@ -534,38 +534,38 @@ def _make_browser(self, browser_name, desired_capabilities=None, def _make_ff(self , remote , desired_capabilites , profile_dir): - + if not profile_dir: profile_dir = FIREFOX_PROFILE_DIR profile = webdriver.FirefoxProfile(profile_dir) if remote: - browser = self._create_remote_web_driver(webdriver.DesiredCapabilities.FIREFOX , + browser = self._create_remote_web_driver(webdriver.DesiredCapabilities.FIREFOX , remote , desired_capabilites , profile) else: browser = webdriver.Firefox(firefox_profile=profile) return browser - + def _make_ie(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.Ie, + return self._generic_make_browser(webdriver.Ie, webdriver.DesiredCapabilities.INTERNETEXPLORER, remote, desired_capabilities) def _make_chrome(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.Chrome, + return self._generic_make_browser(webdriver.Chrome, webdriver.DesiredCapabilities.CHROME, remote, desired_capabilities) def _make_opera(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.Opera, + return self._generic_make_browser(webdriver.Opera, webdriver.DesiredCapabilities.OPERA, remote, desired_capabilities) def _make_phantomjs(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.PhantomJS, + return self._generic_make_browser(webdriver.PhantomJS, webdriver.DesiredCapabilities.PHANTOMJS, remote, desired_capabilities) def _make_htmlunit(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.Remote, + return self._generic_make_browser(webdriver.Remote, webdriver.DesiredCapabilities.HTMLUNIT, remote, desired_capabilities) def _make_htmlunitwithjs(self , remote , desired_capabilities , profile_dir): - return self._generic_make_browser(webdriver.Remote, + return self._generic_make_browser(webdriver.Remote, webdriver.DesiredCapabilities.HTMLUNITWITHJS, remote, desired_capabilities) def _make_android(self , remote , desired_capabilities , profile_dir): @@ -581,9 +581,9 @@ def _make_safari(self , remote , desired_capabilities , profile_dir): webdriver.DesiredCapabilities.SAFARI, remote, desired_capabilities) def _generic_make_browser(self, webdriver_type , desired_cap_type, remote_url, desired_caps): - '''most of the make browser functions just call this function which creates the + '''most of the make browser functions just call this function which creates the appropriate web-driver''' - if not remote_url: + if not remote_url: browser = webdriver_type() else: browser = self._create_remote_web_driver(desired_cap_type,remote_url , desired_caps) @@ -617,4 +617,3 @@ def _parse_capabilities_string(self, capabilities_string): desired_capabilities[key.strip()] = value.strip() return desired_capabilities - diff --git a/src/Selenium2Library/keywords/_element.py b/src/Selenium2Library/keywords/_element.py index 5a2cf7470..48bd34aca 100644 --- a/src/Selenium2Library/keywords/_element.py +++ b/src/Selenium2Library/keywords/_element.py @@ -21,6 +21,13 @@ def __init__(self): # Public, get element(s) + def get_webelement(self, locator): + """Returns the first WebElement matching the given locator. + + See `introduction` for details about locating elements. + """ + return self._element_find(locator, True, True) + def get_webelements(self, locator): """Returns list of WebElement objects matching locator. @@ -478,18 +485,15 @@ def simulate(self, locator, event): 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 + `key` is either a single character, a string, or a numerical ASCII code of the key lead by '\\\\'. - Examples: | Press Key | text_field | q | + | Press Key | text_field | abcde | | Press Key | login_button | \\\\13 | # ASCII code for enter key | """ if key.startswith('\\') and len(key) > 1: key = self._map_ascii_key_code_to_key(int(key[1:])) - #if len(key) > 1: - # raise ValueError("Key value '%s' is invalid.", key) element = self._element_find(locator, True, True) #select it element.send_keys(key) @@ -599,7 +603,7 @@ 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: @@ -615,7 +619,7 @@ def xpath_should_match_x_times(self, xpath, expected_xpath_count, message='', lo """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: @@ -748,6 +752,14 @@ def _map_ascii_key_code_to_key(self, key_code): key = chr(key_code) return key + def _map_named_key_code_to_special_key(self, key_name): + try: + return getattr(Keys, key_name) + except AttributeError: + message = "Unknown key named '%s'." % (key_name) + self._debug(message) + raise ValueError(message) + def _parse_attribute_locator(self, attribute_locator): parts = attribute_locator.rpartition('@') if len(parts[0]) == 0: diff --git a/src/Selenium2Library/keywords/_logging.py b/src/Selenium2Library/keywords/_logging.py index 7080c8641..4d33d2f7a 100644 --- a/src/Selenium2Library/keywords/_logging.py +++ b/src/Selenium2Library/keywords/_logging.py @@ -3,7 +3,12 @@ from robot.api import logger from keywordgroup import KeywordGroup from robot.libraries.BuiltIn import BuiltIn -from robot.libraries.BuiltIn import RobotNotRunningError + +try: + from robot.libraries.BuiltIn import RobotNotRunningError +except ImportError: + RobotNotRunningError = AttributeError + class _LoggingKeywords(KeywordGroup): diff --git a/src/Selenium2Library/keywords/_screenshot.py b/src/Selenium2Library/keywords/_screenshot.py index 7c2c8a480..27a226b38 100644 --- a/src/Selenium2Library/keywords/_screenshot.py +++ b/src/Selenium2Library/keywords/_screenshot.py @@ -8,7 +8,7 @@ class _ScreenshotKeywords(KeywordGroup): def __init__(self): - self._screenshot_index = 0 + self._screenshot_index = {} self._screenshot_path_stack = [] self.screenshot_root_directory = None @@ -32,30 +32,57 @@ def set_screenshot_directory(self, path, persist=False): self.screenshot_root_directory = path - def capture_page_screenshot(self, filename=None): + def capture_page_screenshot(self, filename=None, overwrite=False): """Takes a screenshot of the current page and embeds it into the log. `filename` argument specifies the name of the file to write the - screenshot into. If no `filename` is given, the screenshot is saved into file - `selenium-screenshot-.png` under the directory where - the Robot Framework log file is written into. The `filename` is + screenshot into. If no `filename` is given, the screenshot is + saved into file `selenium-screenshot-.png` under the directory + where the Robot Framework log file is written into. The `filename` is also considered relative to the same directory, if it is not given in absolute format. If an absolute or relative path is given but the path does not exist it will be created. - `css` can be used to modify how the screenshot is taken. By default - the bakground color is changed to avoid possible problems with - background leaking when the page layout is somehow broken. + With `overwrite` it is possible to define what is done if file already + exist. By default filename is not overwritten but new one is created + by adding in the end. Example if capture.png exist and + this is the first overwrite, then new file is created with name + capture-1.png + + Example: + | Open Browser | www.someurl.com | browser=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | + | Capture Page Screenshot | filename=${BROWSER} | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}.png | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-1.png | + | File Should Exist | ${OUTPUTDIR}${/}${BROWSER}-2.png | + | Capture Page Screenshot | + | Capture Page Screenshot | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | + | Capture Page Screenshot | filename=DefaultName.png | overwrite=${True} | + | Capture Page Screenshot | filename=DefaultName.png | overwrite=${True} | + | File Should Exist | ${OUTPUTDIR}${/}DefaultName.png | + | File Should Not Exist | ${OUTPUTDIR}${/}DefaultName-1.png | + + *NOTE:* The `overwrite` is ignored if `filename` is not defined + Example: + | Open Browser | www.someurl.com | browser=${BROWSER} | + | Capture Page Screenshot | overwrite=${True} | # overwrite is ignored | + | Capture Page Screenshot | overwrite=${True} | # overwrite is ignored | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-1.png | + | File Should Exist | ${OUTPUTDIR}${/}selenium-screenshot-2.png | """ - path, link = self._get_screenshot_paths(filename) - self._create_directory(path) + path, link = self._get_screenshot_paths(filename, overwrite=overwrite) + self._create_directory(path) if hasattr(self._current_browser(), 'get_screenshot_as_file'): - if not self._current_browser().get_screenshot_as_file(path): - raise RuntimeError('Failed to save screenshot ' + filename) + if not self._current_browser().get_screenshot_as_file(path): + raise RuntimeError('Failed to save screenshot ' + filename) else: - if not self._current_browser().save_screenshot(path): - raise RuntimeError('Failed to save screenshot ' + filename) + if not self._current_browser().save_screenshot(path): + raise RuntimeError('Failed to save screenshot ' + filename) # Image is shown on its own row and thus prev row is closed on purpose self._html('' @@ -86,15 +113,41 @@ def _get_screenshot_directory(self): def _restore_screenshot_directory(self): self.screenshot_root_directory = self._screenshot_path_stack.pop() - def _get_screenshot_paths(self, filename): + def _get_screenshot_paths(self, filename, overwrite=False): if not filename: - self._screenshot_index += 1 - filename = 'selenium-screenshot-%d.png' % self._screenshot_index + index = self._get_new_index('selenium-screenshot') + filename = 'selenium-screenshot-%d.png' % index + elif filename and not overwrite: + filename = self._screenshot_existence(filename.replace('/', + os.sep)) else: filename = filename.replace('/', os.sep) - screenshotDir = self._get_screenshot_directory() - logDir = self._get_log_dir() - path = os.path.join(screenshotDir, filename) - link = robot.utils.get_link_path(path, logDir) + screenshot_dir = self._get_screenshot_directory() + logdir = self._get_log_dir() + path = os.path.join(screenshot_dir, filename) + link = robot.utils.get_link_path(path, logdir) return path, link + + def _screenshot_existence(self, filename): + if os.path.exists(self._get_logdir_path(filename)[0]): + index = self._get_new_index(filename) + try: + return '-%s.png'.join(filename.rsplit('.png', 1)) % index + except TypeError: + return filename + '-%s' % index + else: + return filename + + def _get_logdir_path(self, filename): + logdir = self._get_log_dir() + return os.path.join(logdir, filename), logdir + + def _get_new_index(self, filename): + try: + index = self._screenshot_index[filename] + 1 + self._screenshot_index[filename] = index + return index + except KeyError: + self._screenshot_index[filename] = 1 + return 1 diff --git a/src/Selenium2Library/version.py b/src/Selenium2Library/version.py index 7b59fb64f..631735687 100644 --- a/src/Selenium2Library/version.py +++ b/src/Selenium2Library/version.py @@ -1 +1 @@ -VERSION = '1.7.2' +VERSION = '1.7.4' diff --git a/test/acceptance/create_webdriver.robot b/test/acceptance/create_webdriver.robot index 4bfff3db8..56c9b754f 100644 --- a/test/acceptance/create_webdriver.robot +++ b/test/acceptance/create_webdriver.robot @@ -1,35 +1,52 @@ -*Setting* -Resource resource.robot -Library Collections +*** Setting *** +Documentation Tests Webdriver +Resource resource.robot +Library Collections -*Test Cases* +*** Test Cases *** Create Webdriver Creates Functioning WebDriver - [Documentation] LOG 2:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver LOG 2:4 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+ - [Setup] Set Driver Variables - Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} - Go To ${FRONT PAGE} - Page Should Contain needle - [Teardown] Close Browser + [Documentation] LOG 2:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver + ... LOG 2:4 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+ + [Setup] Set Driver Variables + Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} + Go To ${FRONT PAGE} + Page Should Contain needle + [Teardown] Close Browser Create Webdriver With Bad Driver Name - Run Keyword And Expect Error 'Fireox' is not a valid WebDriver name Create Webdriver Fireox + [Documentation] Invalid browser name + Run Keyword And Expect Error 'Fireox' is not a valid WebDriver name + ... Create Webdriver Fireox Create Webdriver With Duplicate Arguments - ${kwargs}= Create Dictionary arg 1 - Run Keyword And Expect Error Got multiple values for argument 'arg'. Create Webdriver Firefox kwargs=${kwargs} arg=2 + [Documentation] Invalid values in arguments + ${kwargs}= Create Dictionary arg=1 + Run Keyword And Expect Error Got multiple values for argument 'arg'. + ... Create Webdriver Firefox kwargs=${kwargs} arg=2 Create Webdriver With Bad Keyword Argument Dictionary - Run Keyword And Expect Error kwargs must be a dictionary. Create Webdriver Firefox kwargs={'spam': 'eggs'} + [Documentation] Invalid arguments types + Run Keyword And Expect Error kwargs must be a dictionary. + ... Create Webdriver Firefox kwargs={'spam': 'eggs'} -*Keywords* +*** Keywords *** Set Driver Variables - ${drivers}= Create Dictionary ff Firefox firefox Firefox ie Ie internetexplorer Ie googlechrome Chrome gc Chrome chrome Chrome opera Opera phantomjs PhantomJS safari Safari - ${name}= Evaluate "Remote" if "${REMOTE_URL}"!="None" else ${drivers}["${BROWSER.lower().replace(' ', '')}"] - Set Test Variable ${DRIVER_NAME} ${name} - ${dc names}= Create Dictionary ff FIREFOX firefox FIREFOX ie INTERNETEXPLORER internetexplorer INTERNETEXPLORER googlechrome CHROME gc CHROME chrome CHROME opera OPERA phantomjs PHANTOMJS htmlunit HTMLUNIT htmlunitwithjs HTMLUNITWITHJS android ANDROID iphone IPHONE safari SAFARI - ${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')} - ${caps}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.${dc name} selenium.webdriver,sys - ${url as str}= Evaluate str('${REMOTE_URL}') # cannot be unicode for several versions >= 2.32 - ${kwargs}= Create Dictionary - Run Keyword If "${name}"=="Remote" Set To Dictionary ${kwargs} command_executor ${url as str} desired_capabilities ${caps} - Set Test Variable ${KWARGS} ${kwargs} + [Documentation] Selects proper driver + ${drivers}= Create Dictionary ff=Firefox firefox=Firefox ie=Ie + ... internetexplorer=Ie googlechrome=Chrome gc=Chrome + ... chrome=Chrome opera=Opera phantomjs=PhantomJS safari=Safari + ${name}= Evaluate "Remote" if "${REMOTE_URL}"!="None" else ${drivers}["${BROWSER.lower().replace(' ', '')}"] + Set Test Variable ${DRIVER_NAME} ${name} + ${dc names}= Create Dictionary ff=FIREFOX firefox=FIREFOX ie=INTERNETEXPLORER + ... internetexplorer=INTERNETEXPLORER googlechrome=CHROME gc=CHROME + ... chrome=CHROME opera=OPERA phantomjs=PHANTOMJS htmlunit=HTMLUNIT + ... htmlunitwithjs=HTMLUNITWITHJS android=ANDROID iphone=IPHONE + ... safari=SAFARI + ${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')} + ${caps}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.${dc name} + ... selenium.webdriver,sys + ${url as str}= Evaluate str('${REMOTE_URL}') # cannot be unicode for versions >= 2.32 + ${kwargs}= Create Dictionary + Run Keyword If "${name}"=="Remote" Set To Dictionary ${kwargs} command_executor + ... ${url as str} desired_capabilities ${caps} + Set Test Variable ${KWARGS} ${kwargs} diff --git a/test/acceptance/keywords/__init__.robot b/test/acceptance/keywords/__init__.robot index 032a95bbe..58158758d 100644 --- a/test/acceptance/keywords/__init__.robot +++ b/test/acceptance/keywords/__init__.robot @@ -1,4 +1,4 @@ -*Setting* -Resource ../resource.robot -Suite Setup Open Browser To Start Page -Suite Teardown Close All Browsers +*** Settings *** +Resource ../resource.robot +Suite Setup Open Browser To Start Page +Suite Teardown Close All Browsers diff --git a/test/acceptance/keywords/async_javascript.robot b/test/acceptance/keywords/async_javascript.robot index 45e54774d..41aba919f 100644 --- a/test/acceptance/keywords/async_javascript.robot +++ b/test/acceptance/keywords/async_javascript.robot @@ -1,92 +1,109 @@ *** Settings *** -Test Setup Go To Page "javascript/dynamic_content.html" -Suite Teardown Set Selenium Timeout 5 seconds -Resource ../resource.robot +Documentation Tests asynchronous javascript +Suite Teardown Set Selenium Timeout 5 seconds +Test Setup Go To Page "javascript/dynamic_content.html" +Resource ../resource.robot *** Test Cases *** Should Not Timeout If Callback Invoked Immediately - ${result} = Execute Async Javascript arguments[arguments.length - 1](123); - Should Be Equal ${result} ${123} + [Documentation] Should Not Timeout If Callback Invoked Immediately + ${result} = Execute Async Javascript arguments[arguments.length - 1](123); + Should Be Equal ${result} ${123} Should Be Able To Return Javascript Primitives From Async Scripts Neither None Nor Undefined - ${result} = Execute Async Javascript arguments[arguments.length - 1](123); - Should Be Equal ${result} ${123} - ${result} = Execute Async Javascript arguments[arguments.length - 1]('abc'); - Should Be Equal ${result} abc - ${result} = Execute Async Javascript arguments[arguments.length - 1](false); - Should Be Equal ${result} ${false} - ${result} = Execute Async Javascript arguments[arguments.length - 1](true); - Should Be Equal ${result} ${true} + [Documentation] Should Be Able To Return Javascript Primitives From Async Scripts + ... Neither None Nor Undefined + ${result} = Execute Async Javascript arguments[arguments.length - 1](123); + Should Be Equal ${result} ${123} + ${result} = Execute Async Javascript arguments[arguments.length - 1]('abc'); + Should Be Equal ${result} abc + ${result} = Execute Async Javascript arguments[arguments.length - 1](false); + Should Be Equal ${result} ${false} + ${result} = Execute Async Javascript arguments[arguments.length - 1](true); + Should Be Equal ${result} ${true} Should Be Able To Return Javascript Primitives From Async Scripts Null And Undefined - ${result} = Execute Async Javascript arguments[arguments.length - 1](null); - Should Be Equal ${result} ${None} - ${result} = Execute Async Javascript arguments[arguments.length - 1](); - Should Be Equal ${result} ${None} + [Documentation] Should Be Able To Return Javascript Primitives From Async Scripts + ... Null And Undefined + ${result} = Execute Async Javascript arguments[arguments.length - 1](null); + Should Be Equal ${result} ${None} + ${result} = Execute Async Javascript arguments[arguments.length - 1](); + Should Be Equal ${result} ${None} Should Be Able To Return An Array Literal From An Async Script - ${result} = Execute Async Javascript arguments[arguments.length - 1]([]); - Should Not Be Equal ${result} ${None} - Length Should Be ${result} 0 + [Documentation] Should Be Able To Return An Array Literal From An Async Script + ${result} = Execute Async Javascript arguments[arguments.length - 1]([]); + Should Not Be Equal ${result} ${None} + Length Should Be ${result} 0 Should Be Able To Return An Array Object From An Async Script - ${result} = Execute Async Javascript arguments[arguments.length - 1](new Array()); - Should Not Be Equal ${result} ${None} - Length Should Be ${result} 0 + [Documentation] Should Be Able To Return An Array Object From An Async Script + ${result} = Execute Async Javascript arguments[arguments.length - 1](new Array()); + Should Not Be Equal ${result} ${None} + Length Should Be ${result} 0 Should Be Able To Return Arrays Of Primitives From Async Scripts - ${result} = Execute Async Javascript arguments[arguments.length - 1]([null, 123, 'abc', true, false]); - Should Not Be Equal ${result} ${None} - Length Should Be ${result} 5 - ${value} = Remove From List ${result} -1 - Should Be Equal ${value} ${false} - ${value} = Remove From List ${result} -1 - Should Be Equal ${value} ${true} - ${value} = Remove From List ${result} -1 - Should Be Equal ${value} abc - ${value} = Remove From List ${result} -1 - Should Be Equal ${value} ${123} - ${value} = Remove From List ${result} -1 - Should Be Equal ${value} ${None} - Length Should Be ${result} 0 + [Documentation] Should Be Able To Return Arrays Of Primitives From Async Scripts + ${result} = Execute Async Javascript + ... arguments[arguments.length - 1]([null, 123, 'abc', true, false]); + Should Not Be Equal ${result} ${None} + Length Should Be ${result} 5 + ${value} = Remove From List ${result} -1 + Should Be Equal ${value} ${false} + ${value} = Remove From List ${result} -1 + Should Be Equal ${value} ${true} + ${value} = Remove From List ${result} -1 + Should Be Equal ${value} abc + ${value} = Remove From List ${result} -1 + Should Be Equal ${value} ${123} + ${value} = Remove From List ${result} -1 + Should Be Equal ${value} ${None} + Length Should Be ${result} 0 Should Timeout If Script Does Not Invoke Callback + [Documentation] Should Timeout If Script Does Not Invoke Callback Run Keyword And Expect Error - ... TimeoutException: Message: Timed out waiting for async script result after * - ... Execute Async Javascript return 1 + 2; + ... TimeoutException: Message: Timed out waiting for async script result after * + ... Execute Async Javascript return 1 + 2; Should Timeout If Script Does Not Invoke Callback With A Zero Timeout + [Documentation] Should Timeout If Script Does Not Invoke Callback With A Zero Timeout Run Keyword And Expect Error - ... TimeoutException: Message: Timed out waiting for async script result after * - ... Execute Async Javascript window.setTimeout(function() {}, 0); + ... TimeoutException: Message: Timed out waiting for async script result after * + ... Execute Async Javascript window.setTimeout(function() {}, 0); Should Not Timeout If Script Callsback Inside A Zero Timeout - ${result} = Execute Async Javascript - ... var callback = arguments[arguments.length - 1]; - ... window.setTimeout(function() { callback(123); }, 0) + [Documentation] Should Not Timeout If Script Callsback Inside A Zero Timeout + ${result} = Execute Async Javascript + ... var callback = arguments[arguments.length - 1]; + ... window.setTimeout(function() { callback(123); }, 0) Should Timeout If Script Does Not Invoke Callback With Long Timeout - Set Selenium Timeout 0.5 seconds + [Documentation] Should Timeout If Script Does Not Invoke Callback With Long Timeout + Set Selenium Timeout 0.5 seconds Run Keyword And Expect Error - ... TimeoutException: Message: Timed out waiting for async script result after * - ... Execute Async Javascript var callback = arguments[arguments.length - 1]; window.setTimeout(callback, 1500); + ... TimeoutException: Message: Timed out waiting for async script result after * + ... Execute Async Javascript + ... var callback = arguments[arguments.length - 1]; + ... window.setTimeout(callback, 1500); Should Detect Page Loads While Waiting On An Async Script And Return An Error - Set Selenium Timeout 0.1 seconds + [Documentation] Should Detect Page Loads While Waiting On An Async Script + ... And Return An Error + Set Selenium Timeout 0.1 seconds Run Keyword And Expect Error - ... WebDriverException: Message: Detected a page unload event; async script execution does not work across page loads* - ... Execute Async Javascript window.location = 'javascript/dynamic'; + ... WebDriverException: Message: Detected a page unload event; async script execution does not work across page loads* + ... Execute Async Javascript window.location = 'javascript/dynamic'; Should Catch Errors When Executing Initial Script - Run Keyword And Expect Error - ... WebDriverException: Message: you should catch this!* - ... Execute Async Javascript throw Error('you should catch this!'); - -#TODO Implement Selenium asynchronous javascript test -#Should Be Able To Execute Asynchronous Scripts -# # To Do - -#TODO EdManlove Add support for arguement passing to selenium javascript calls -#Should Be Able To Pass Multiple Arguments To Async Scripts -# ${result} = Execute Async Javascript arguments[arguments.length - 1](arguments[0] + arguments[1]); 1 2 -# Should Be Equal ${result} ${3} + [Documentation] Should Catch Errors When Executing Initial Script + Run Keyword And Expect Error WebDriverException: Message: you should catch this!* + ... Execute Async Javascript throw Error('you should catch this!'); + #TODO Implement Selenium asynchronous javascript test + #Should Be Able To Execute Asynchronous Scripts + # # To Do + #TODO EdManlove Add support for arguement passing to selenium javascript calls + #Should Be Able To Pass Multiple Arguments To Async Scripts + # ${result} = Execute Async Javascript + #... arguments[arguments.length - 1](arguments[0] + arguments[1]); 1 2 + # Should Be Equal ${result} ${3} diff --git a/test/acceptance/keywords/checkbox_and_radio_buttons.robot b/test/acceptance/keywords/checkbox_and_radio_buttons.robot index 6acb63ffc..770e694b2 100644 --- a/test/acceptance/keywords/checkbox_and_radio_buttons.robot +++ b/test/acceptance/keywords/checkbox_and_radio_buttons.robot @@ -1,51 +1,58 @@ *** Settings *** -Test Setup Go To Page "forms/prefilled_email_form.html" -Resource ../resource.robot +Documentation Test checkboxes and radio buttons +Test Setup Go To Page "forms/prefilled_email_form.html" +Resource ../resource.robot *** Test Cases *** Checkbox Should Be Selected - [Documentation] LOG 2 Verifying checkbox 'can_send_email' is selected. - Checkbox Should Be Selected can_send_email - Run Keyword And Expect Error Checkbox 'can_send_sms' should have been selected but was not Checkbox Should Be Selected can_send_sms + [Documentation] LOG 2 Verifying checkbox 'can_send_email' is selected. + Checkbox Should Be Selected can_send_email + Run Keyword And Expect Error Checkbox 'can_send_sms' should have been selected but was not + ... Checkbox Should Be Selected can_send_sms Checkbox Should Not Be Selected - [Documentation] LOG 2 Verifying checkbox 'can_send_sms' is not selected. - Checkbox Should Not Be Selected can_send_sms - Run Keyword And Expect Error Checkbox 'can_send_email' should not have been selected Checkbox Should Not Be Selected can_send_email + [Documentation] LOG 2 Verifying checkbox 'can_send_sms' is not selected. + Checkbox Should Not Be Selected can_send_sms + Run Keyword And Expect Error Checkbox 'can_send_email' should not have been selected + ... Checkbox Should Not Be Selected can_send_email Select Checkbox - [Documentation] LOG 2 Selecting checkbox 'can_send_sms'. - Select Checkbox can_send_sms - Checkbox Should Be Selected can_send_sms - Select Checkbox can_send_sms - Checkbox Should Be Selected can_send_sms + [Documentation] LOG 2 Selecting checkbox 'can_send_sms'. + Select Checkbox can_send_sms + Checkbox Should Be Selected can_send_sms + Select Checkbox can_send_sms + Checkbox Should Be Selected can_send_sms UnSelect Checkbox - [Documentation] LOG 2 Unselecting checkbox 'can_send_email'. - Unselect Checkbox can_send_email - Checkbox Should Not Be Selected can_send_email - Unselect Checkbox can_send_email - Checkbox Should Not Be Selected can_send_email + [Documentation] LOG 2 Unselecting checkbox 'can_send_email'. + Unselect Checkbox can_send_email + Checkbox Should Not Be Selected can_send_email + Unselect Checkbox can_send_email + Checkbox Should Not Be Selected can_send_email Radio Button Should Be Set To - [Documentation] LOG 2 Verifying radio button 'sex' has selection 'female'. - Radio Button Should Be Set To sex female - Run Keyword And Expect Error Selection of radio button 'sex' should have been 'male' but was 'female' Radio Button Should Be Set To sex male + [Documentation] LOG 2 Verifying radio button 'sex' has selection 'female'. + Radio Button Should Be Set To sex female + Run Keyword And Expect Error + ... Selection of radio button 'sex' should have been 'male' but was 'female' + ... Radio Button Should Be Set To sex male Select Radio Button - [Documentation] LOG 2 Selecting 'male' from radio button 'sex'. - Select Radio Button sex male - Radio Button Should Be Set To sex male - Select Radio Button sex female - Radio Button Should Be Set To sex female + [Documentation] LOG 2 Selecting 'male' from radio button 'sex'. + Select Radio Button sex male + Radio Button Should Be Set To sex male + Select Radio Button sex female + Radio Button Should Be Set To sex female Radio Button Should Not Be Selected - [Documentation] LOG 2 Verifying radio button 'referrer' has no selection. - Radio Button Should Not Be Selected referrer - Run Keyword And Expect Error Radio button group 'sex' should not have had selection, but 'female' was selected Radio Button Should Not Be Selected sex + [Documentation] LOG 2 Verifying radio button 'referrer' has no selection. + Radio Button Should Not Be Selected referrer + Run Keyword And Expect Error + ... Radio button group 'sex' should not have had selection, but 'female' was selected + ... Radio Button Should Not Be Selected sex Clicking Radio Button Should Trigger Onclick Event - [Setup] Go To Page "javascript/dynamic_content.html" - Select Radio Button group title - Title Should Be Changed by Button - + [Documentation] Clicking Radio Button Should Trigger Onclick Event + [Setup] Go To Page "javascript/dynamic_content.html" + Select Radio Button group title + Title Should Be Changed by Button diff --git a/test/acceptance/keywords/click_element.robot b/test/acceptance/keywords/click_element.robot index 4c446da17..c820b14a0 100644 --- a/test/acceptance/keywords/click_element.robot +++ b/test/acceptance/keywords/click_element.robot @@ -1,21 +1,23 @@ *** Settings *** -Suite Setup Go To Page "javascript/click.html" -Test Setup Initialize Page -Resource ../resource.robot +Documentation Tests clicking element +Suite Setup Go To Page "javascript/click.html" +Test Setup Initialize Page +Resource ../resource.robot *** Test Cases *** Click Element - [Documentation] LOG 2 Clicking element 'singleClickButton'. - Click Element singleClickButton - Element Text Should Be output single clicked + [Documentation] LOG 2 Clicking element 'singleClickButton'. + Click Element singleClickButton + Element Text Should Be output single clicked Double Click Element - [Documentation] LOG 2 Double clicking element 'doubleClickButton'. - [Tags] Known Issue - Firefox - Double Click Element doubleClickButton - Element Text Should Be output double clicked + [Documentation] LOG 2 Double clicking element 'doubleClickButton'. + [Tags] Known Issue - Firefox + Double Click Element doubleClickButton + Element Text Should Be output double clicked *** Keywords *** Initialize Page + [Documentation] Initialize Page Reload Page - Element Text Should Be output initial output + Element Text Should Be output initial output diff --git a/test/acceptance/keywords/click_element_at_coordinates.robot b/test/acceptance/keywords/click_element_at_coordinates.robot index 902f4584c..32e08a602 100644 --- a/test/acceptance/keywords/click_element_at_coordinates.robot +++ b/test/acceptance/keywords/click_element_at_coordinates.robot @@ -1,4 +1,5 @@ *** Settings *** +Documentation Clicks element at coordinates Suite Setup Go To Page "javascript/click_at_coordinates.html" Test Setup Initialize Page Resource ../resource.robot @@ -7,12 +8,13 @@ Resource ../resource.robot Click Element At Coordinates [Documentation] LOG 2 Click clicking element 'Clickable' in coordinates '10', '20'. [Tags] Known Issue - Firefox - Click Element At Coordinates Clickable ${10} ${20} + Click Element At Coordinates Clickable ${10} ${20} Element Text Should Be outputX 110 Element Text Should Be outputY 120 *** Keywords *** Initialize page + [Documentation] Initialize page Reload Page Element Text Should Be outputX initial outputX Element Text Should Be outputY initial outputY diff --git a/test/acceptance/keywords/content_assertions.robot b/test/acceptance/keywords/content_assertions.robot index 392ddc49b..7dfd32c56 100644 --- a/test/acceptance/keywords/content_assertions.robot +++ b/test/acceptance/keywords/content_assertions.robot @@ -1,250 +1,330 @@ *** Settings *** -Test Setup Go To Front Page -Default Tags assertions -Resource ../resource.robot - +Documentation Tests contents +Test Setup Go To Front Page +Default Tags assertions +Resource ../resource.robot *** Test Cases *** Location Should Be - [Documentation] LOG 2:3 Current location is '${FRONT PAGE}'. - Location Should Be ${FRONT PAGE} - Run Keyword And Expect Error Location should have been 'non existing' but was '${FRONT PAGE}' Location Should Be non existing + [Documentation] LOG 2:3 Current location is '${FRONT PAGE}'. + Location Should Be ${FRONT PAGE} + Run Keyword And Expect Error Location should have been 'non existing' but was '${FRONT PAGE}' + ... Location Should Be non existing Location Should Contain - [Documentation] LOG 2:3 Current location contains 'html'. - Location Should Contain html - Run Keyword And Expect Error Location should have contained 'not a location' but it was '${FRONT PAGE}'. Location Should Contain not a location + [Documentation] LOG 2:3 Current location contains 'html'. + Location Should Contain html + Run Keyword And Expect Error + ... Location should have contained 'not a location' but it was '${FRONT PAGE}'. + ... Location Should Contain not a location Title Should Be - [Documentation] LOG 2:3 Page title is '(root)/index.html'. - Title Should Be (root)/index.html - Run Keyword And Expect Error Title should have been 'not a title' but was '(root)/index.html' Title Should Be not a title + [Documentation] LOG 2:3 Page title is '(root)/index.html'. + Title Should Be (root)/index.html + Run Keyword And Expect Error Title should have been 'not a title' but was '(root)/index.html' + ... Title Should Be not a title Page Should Contain - [Documentation] LOG 2:5 Current page contains text 'needle'. LOG 4.1:10 REGEXP: (?i) - Page Should Contain needle - Page Should Contain This is the haystack - Run Keyword And Expect Error Page should have contained text 'non existing text' but did not Page Should Contain non existing text + [Documentation] LOG 2:5 Current page contains text 'needle'. + ... LOG 4.1:10 REGEXP: (?i) + Page Should Contain needle + Page Should Contain This is the haystack + Run Keyword And Expect Error Page should have contained text 'non existing text' but did not + ... Page Should Contain non existing text Page Should Contain With Custom Log Level - [Documentation] LOG 2.1:10 DEBUG REGEXP: (?i) - Run Keyword And Expect Error Page should have contained text 'non existing text' but did not Page Should Contain non existing text DEBUG + [Documentation] LOG 2.1:10 DEBUG REGEXP: (?i) + Run Keyword And Expect Error Page should have contained text 'non existing text' but did not + ... Page Should Contain non existing text DEBUG Page Should Contain With Disabling Source Logging - [Documentation] LOG 3:2 NONE - Set Log Level INFO - Run Keyword And Expect Error Page should have contained text 'non existing text' but did not Page Should Contain non existing text loglevel=NONE - [Teardown] Set Log Level DEBUG + [Documentation] LOG 3:2 NONE + Set Log Level INFO + Run Keyword And Expect Error Page should have contained text 'non existing text' but did not + ... Page Should Contain non existing text loglevel=NONE + [Teardown] Set Log Level DEBUG Page Should Contain With Frames - [Setup] Go To Page "frames/frameset.html" - Page Should Contain You're looking at right. + [Documentation] Page Should Contain With Frames + [Setup] Go To Page "frames/frameset.html" + Page Should Contain You're looking at right. Page Should Not Contain - [Documentation] LOG 2:8 Current page does not contain text 'non existing text'. LOG 3.1:7 REGEXP: (?i) - Page Should Not Contain non existing text - Run Keyword And Expect Error Page should not have contained text 'needle' Page Should Not Contain needle + [Documentation] LOG 2:8 Current page does not contain text 'non existing text'. + ... LOG 3.1:7 REGEXP: (?i) + Page Should Not Contain non existing text + Run Keyword And Expect Error Page should not have contained text 'needle' + ... Page Should Not Contain needle Page Should Not Contain With Custom Log Level - [Documentation] LOG 2.1:7 DEBUG REGEXP: (?i) - Run Keyword And Expect Error Page should not have contained text 'needle' Page Should Not Contain needle DEBUG + [Documentation] LOG 2.1:7 DEBUG REGEXP: (?i) + Run Keyword And Expect Error Page should not have contained text 'needle' + ... Page Should Not Contain needle DEBUG Page Should Not Contain With Disabling Source Logging - [Documentation] LOG 3:2 NONE - Set Log Level INFO - Run Keyword And Expect Error Page should not have contained text 'needle' Page Should Not Contain needle loglevel=NONE - [Teardown] Set Log Level DEBUG + [Documentation] LOG 3:2 NONE + Set Log Level INFO + Run Keyword And Expect Error Page should not have contained text 'needle' + ... Page Should Not Contain needle loglevel=NONE + [Teardown] Set Log Level DEBUG Page Should Contain Element - Page Should Contain Element some_id - Run Keyword And Expect Error Page should have contained element 'non-existent' but did not Page Should Contain Element non-existent + [Documentation] Page Should Contain Element + Page Should Contain Element some_id + Run Keyword And Expect Error Page should have contained element 'non-existent' but did not + ... Page Should Contain Element non-existent Page Should Contain Element With Custom Message - Run Keyword And Expect Error Custom error message Page Should Contain Element invalid Custom error message + [Documentation] Page Should Contain Element With Custom Message + Run Keyword And Expect Error Custom error message Page Should Contain Element + ... invalid Custom error message Page Should Contain Element With Disabling Source Logging - [Documentation] LOG 3:2 NONE - Set Log Level INFO - Run Keyword And Expect Error Page should have contained element 'non-existent' but did not Page Should Contain Element non-existent loglevel=NONE - [Teardown] Set Log Level DEBUG + [Documentation] LOG 3:2 NONE + Set Log Level INFO + Run Keyword And Expect Error Page should have contained element 'non-existent' but did not + ... Page Should Contain Element non-existent loglevel=NONE + [Teardown] Set Log Level DEBUG Page Should Not Contain Element - Page Should Not Contain Element non-existent - Run Keyword And Expect Error Page should not have contained element 'some_id' Page Should Not Contain Element some_id + [Documentation] Page Should Not Contain Element + Page Should Not Contain Element non-existent + Run Keyword And Expect Error Page should not have contained element 'some_id' + ... Page Should Not Contain Element some_id Page Should Not Contain Element With Disabling Source Logging - [Documentation] LOG 3:2 NONE - Set Log Level INFO - Run Keyword And Expect Error Page should not have contained element 'some_id' Page Should Not Contain Element some_id loglevel=NONE - [Teardown] Set Log Level DEBUG + [Documentation] LOG 3:2 NONE + Set Log Level INFO + Run Keyword And Expect Error Page should not have contained element 'some_id' + ... Page Should Not Contain Element some_id loglevel=NONE + [Teardown] Set Log Level DEBUG Element Should Contain - Element Should Contain some_id This text is inside an identified element - Run Keyword And Expect Error Element 'some_id' should have contained text 'non existing text' but its text was 'This text is inside an identified element'. Element Should Contain some_id non existing text - Run Keyword And Expect Error ValueError: Element locator 'missing_id' did not match any elements. Element Should Contain missing_id This should report missing element. + [Documentation] Element Should Contain + Element Should Contain some_id This text is inside an identified element + Run Keyword And Expect Error + ... Element 'some_id' should have contained text 'non existing text' but its text was 'This text is inside an identified element'. + ... Element Should Contain some_id non existing text + Run Keyword And Expect Error + ... ValueError: Element locator 'missing_id' did not match any elements. + ... Element Should Contain missing_id This should report missing element. Element Should Not Contain - Element Should Not Contain some_id This text is not inside an identified element - Element Should Not Contain some_id elementypo - Run Keyword And Expect Error Element 'some_id' should not contain text 'This text is inside an identified element' but it did. Element Should Not Contain some_id This text is inside an identified element - Run Keyword And Expect Error ValueError: Element locator 'missing_id' did not match any elements. Element Should Not Contain missing_id This should report missing element. + [Documentation] Element Should Not Contain + Element Should Not Contain some_id This text is not inside an identified element + Element Should Not Contain some_id elementypo + Run Keyword And Expect Error + ... Element 'some_id' should not contain text 'This text is inside an identified element' but it did. + ... Element Should Not Contain some_id This text is inside an identified element + Run Keyword And Expect Error + ... ValueError: Element locator 'missing_id' did not match any elements. + ... Element Should Not Contain missing_id This should report missing element. Element Text Should Be - Element Text Should Be some_id This text is inside an identified element - Run Keyword And Expect Error The text of element 'some_id' should have been 'inside' but in fact it was 'This text is inside an identified element'. Element Text Should Be some_id inside + [Documentation] Element Text Should Be + Element Text Should Be some_id This text is inside an identified element + Run Keyword And Expect Error + ... The text of element 'some_id' should have been 'inside' but in fact it was 'This text is inside an identified element'. + ... Element Text Should Be some_id inside Get Text - ${str} = Get Text some_id - Should Match ${str} This text is inside an identified element - Run Keyword And Expect Error ValueError: Element locator 'missing_id' did not match any elements. Get Text missing_id + [Documentation] Get Text + ${str} = Get Text some_id + Should Match ${str} This text is inside an identified element + Run Keyword And Expect Error + ... ValueError: Element locator 'missing_id' did not match any elements. + ... Get Text missing_id Element Should Be Visible - [Setup] Go To Page "visibility.html" - Element Should Be Visible i_am_visible - Run Keyword And Expect Error The element 'i_am_hidden' should be visible, but it is not. Element Should Be Visible i_am_hidden + [Documentation] Element Should Be Visible + [Setup] Go To Page "visibility.html" + Element Should Be Visible i_am_visible + Run Keyword And Expect Error The element 'i_am_hidden' should be visible, but it is not. + ... Element Should Be Visible i_am_hidden Element Should Not Be Visible - [Setup] Go To Page "visibility.html" - Element Should Not Be Visible i_am_hidden - Run Keyword And Expect Error The element 'i_am_visible' should not be visible, but it is. Element Should Not Be Visible i_am_visible + [Documentation] Element Should Not Be Visible + [Setup] Go To Page "visibility.html" + Element Should Not Be Visible i_am_hidden + Run Keyword And Expect Error The element 'i_am_visible' should not be visible, but it is. + ... Element Should Not Be Visible i_am_visible Page Should Contain Checkbox - [Documentation] LOG 2:5 Current page contains checkbox 'can_send_email'. - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Contain Checkbox can_send_email - Page Should Contain Checkbox xpath=//input[@type='checkbox' and @name='can_send_sms'] - Run Keyword And Expect Error Page should have contained checkbox 'non-existing' but did not Page Should Contain Checkbox non-existing + [Documentation] LOG 2:5 Current page contains checkbox 'can_send_email'. + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Contain Checkbox can_send_email + Page Should Contain Checkbox xpath=//input[@type='checkbox' and @name='can_send_sms'] + Run Keyword And Expect Error Page should have contained checkbox 'non-existing' but did not + ... Page Should Contain Checkbox non-existing Page Should Not Contain Checkbox - [Documentation] LOG 2:5 Current page does not contain checkbox 'non-existing'. - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Not Contain Checkbox non-existing - Run Keyword And Expect Error Page should not have contained checkbox 'can_send_email' Page Should Not Contain Checkbox can_send_email + [Documentation] LOG 2:5 Current page does not contain checkbox 'non-existing'. + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Not Contain Checkbox non-existing + Run Keyword And Expect Error Page should not have contained checkbox 'can_send_email' + ... Page Should Not Contain Checkbox can_send_email Page Should Contain Radio Button - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Contain Radio Button sex - Page Should Contain Radio Button xpath=//input[@type="radio" and @value="male"] - Run Keyword And Expect Error Page should have contained radio button 'non-existing' but did not Page Should Contain Radio Button non-existing + [Documentation] Page Should Contain Radio Button + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Contain Radio Button sex + Page Should Contain Radio Button xpath=//input[@type="radio" and @value="male"] + Run Keyword And Expect Error Page should have contained radio button 'non-existing' but did not + ... Page Should Contain Radio Button non-existing Page Should Not Contain Radio Button - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Not Contain Radio Button non-existing - Run Keyword And Expect Error Page should not have contained radio button 'sex' Page Should Not Contain Radio Button sex + [Documentation] Page Should Not Contain Radio Button + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Not Contain Radio Button non-existing + Run Keyword And Expect Error Page should not have contained radio button 'sex' + ... Page Should Not Contain Radio Button sex Page Should Contain Image - [Setup] Go To Page "links.html" - Page Should contain Image image.jpg - Run Keyword And Expect Error Page should have contained image 'non-existent' but did not Page Should contain Image non-existent + [Documentation] Page Should Contain Image + [Setup] Go To Page "links.html" + Page Should contain Image image.jpg + Run Keyword And Expect Error Page should have contained image 'non-existent' but did not + ... Page Should contain Image non-existent Page Should Not Contain Image - [Setup] Go To Page "links.html" - Page Should not contain Image non-existent - Run Keyword And Expect Error Page should not have contained image 'image.jpg' Page Should not contain Image image.jpg + [Documentation] Page Should Not Contain Image + [Setup] Go To Page "links.html" + Page Should not contain Image non-existent + Run Keyword And Expect Error Page should not have contained image 'image.jpg' + ... Page Should not contain Image image.jpg Page Should Contain Link - [Setup] Go To Page "links.html" - Page Should contain link Relative - Page Should contain link sub/index.html - Run Keyword And Expect Error Page should have contained link 'non-existent' but did not Page Should contain link non-existent + [Documentation] Page Should Contain Link + [Setup] Go To Page "links.html" + Page Should contain link Relative + Page Should contain link sub/index.html + Run Keyword And Expect Error Page should have contained link 'non-existent' but did not + ... Page Should contain link non-existent Page Should Not Contain Link - [Setup] Go To Page "links.html" - Page Should not contain link non-existent - Run Keyword And Expect Error Page should not have contained link 'Relative' Page Should not contain link Relative + [Documentation] Page Should Not Contain Link + [Setup] Go To Page "links.html" + Page Should not contain link non-existent + Run Keyword And Expect Error Page should not have contained link 'Relative' + ... Page Should not contain link Relative Page Should Contain List - [Setup] Go To Page "forms/prefilled_email_form.html" - Page should Contain List possible_channels - Run Keyword And Expect Error Page should have contained list 'non-existing' but did not Page Should Contain List non-existing + [Documentation] Page Should Contain List + [Setup] Go To Page "forms/prefilled_email_form.html" + Page should Contain List possible_channels + Run Keyword And Expect Error Page should have contained list 'non-existing' but did not + ... Page Should Contain List non-existing Page Should Not Contain List - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Not Contain List non-existing - Run Keyword And Expect Error Page should not have contained list 'possible_channels' Page Should Not Contain List possible_channels + [Documentation] Page Should Not Contain List + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Not Contain List non-existing + Run Keyword And Expect Error Page should not have contained list 'possible_channels' + ... Page Should Not Contain List possible_channels Page Should Contain TextField - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Contain Text Field name - Page Should Contain Text Field xpath=//input[@type='text' and @name='email'] - Run Keyword And Expect Error Page should have contained text field 'non-existing' but did not Page Should Contain Text Field non-existing + [Documentation] Page Should Contain TextField + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Contain Text Field name + Page Should Contain Text Field xpath=//input[@type='text' and @name='email'] + Run Keyword And Expect Error Page should have contained text field 'non-existing' but did not + ... Page Should Contain Text Field non-existing Page Should Not Contain Text Field - [Setup] Go To Page "forms/prefilled_email_form.html" - Page Should Not Contain Text Field non-existing - Run Keyword And Expect Error Page should not have contained text field 'name' Page Should Not Contain Text Field name + [Documentation] Page Should Not Contain Text Field + [Setup] Go To Page "forms/prefilled_email_form.html" + Page Should Not Contain Text Field non-existing + Run Keyword And Expect Error Page should not have contained text field 'name' + ... Page Should Not Contain Text Field name TextField Should Contain - [Documentation] LOG 2:7 Text field 'name' contains text ''. - [Setup] Go To Page "forms/email_form.html" - TextField Should contain name ${EMPTY} - Input Text name my name - TextField Should contain name my name - Run Keyword And Expect Error Text field 'name' should have contained text 'non-existing' but it contained 'my name' TextField Should contain name non-existing + [Documentation] LOG 2:7 Text field 'name' contains text ''. + [Setup] Go To Page "forms/email_form.html" + TextField Should contain name ${EMPTY} + Input Text name my name + TextField Should contain name my name + Run Keyword And Expect Error + ... Text field 'name' should have contained text 'non-existing' but it contained 'my name' + ... TextField Should contain name non-existing TextField Value Should Be - [Documentation] LOG 2:7 Content of text field 'name' is ''. - [Setup] Go To Page "forms/email_form.html" - textfield Value Should Be name ${EMPTY} - Input Text name my name - textfield Value Should Be name my name - Run Keyword And Expect Error Value of text field 'name' should have been 'non-existing' but was 'my name' textfield Value Should Be name non-existing - Clear Element Text name - Textfield Value Should Be name ${EMPTY} + [Documentation] LOG 2:7 Content of text field 'name' is ''. + [Setup] Go To Page "forms/email_form.html" + textfield Value Should Be name ${EMPTY} + Input Text name my name + textfield Value Should Be name my name + Run Keyword And Expect Error + ... Value of text field 'name' should have been 'non-existing' but was 'my name' + ... textfield Value Should Be name non-existing + Clear Element Text name + Textfield Value Should Be name ${EMPTY} TextArea Should Contain - [Setup] Go To Page "forms/email_form.html" - TextArea Should Contain comment ${EMPTY} - Input Text comment This is a comment. + [Documentation] TextArea Should Contain + [Setup] Go To Page "forms/email_form.html" + TextArea Should Contain comment ${EMPTY} + Input Text comment This is a comment. Run Keyword And Expect Error - ... Text field 'comment' should have contained text 'Hello World!' but it contained 'This is a comment.' - ... TextArea Should Contain comment Hello World! + ... Text field 'comment' should have contained text 'Hello World!' but it contained 'This is a comment.' + ... TextArea Should Contain comment Hello World! TextArea Value Should Be - [Setup] Go To Page "forms/email_form.html" - TextArea Value Should Be comment ${EMPTY} - Input Text comment This is a comment. + [Documentation] TextArea Value Should Be + [Setup] Go To Page "forms/email_form.html" + TextArea Value Should Be comment ${EMPTY} + Input Text comment This is a comment. Run Keyword And Expect Error - ... Text field 'comment' should have contained text 'Hello World!' but it contained 'This is a comment.' - ... TextArea Value Should Be comment Hello World! - Clear Element Text comment - TextArea Value Should Be comment ${EMPTY} + ... Text field 'comment' should have contained text 'Hello World!' but it contained 'This is a comment.' + ... TextArea Value Should Be comment Hello World! + Clear Element Text comment + TextArea Value Should Be comment ${EMPTY} Page Should Contain Button - [Setup] Go To Page "forms/buttons.html" - Page Should Contain Button button - Page Should Contain Button Sisään - Page Should Contain Button Get In - Page Should Contain Button xpath=//button[@type="submit"] - Page Should Contain Button Ulos - Page Should Contain Button xpath=//input[@type="submit"] - Page Should Contain Button Act! - Page Should Contain Button xpath=//input[@type="button"] - Run Keyword And Expect Error Page should have contained button 'non-existing' but did not Page Should Contain Button non-existing + [Documentation] Page Should Contain Button + [Setup] Go To Page "forms/buttons.html" + Page Should Contain Button button + Page Should Contain Button Sisään + Page Should Contain Button Get In + Page Should Contain Button xpath=//button[@type="submit"] + Page Should Contain Button Ulos + Page Should Contain Button xpath=//input[@type="submit"] + Page Should Contain Button Act! + Page Should Contain Button xpath=//input[@type="button"] + Run Keyword And Expect Error Page should have contained button 'non-existing' but did not + ... Page Should Contain Button non-existing Page Should Not Contain Button In Button Tag - [Setup] Go To Page "forms/buttons.html" - Page Should Not Contain Button invalid - Run Keyword And Expect Error Page should not have contained button 'button' Page Should Not Contain Button button + [Documentation] Page Should Not Contain Button In Button Tag + [Setup] Go To Page "forms/buttons.html" + Page Should Not Contain Button invalid + Run Keyword And Expect Error Page should not have contained button 'button' + ... Page Should Not Contain Button button Page Should Not Contain Button In Input Tag - [Setup] Go To Page "forms/buttons.html" - Page Should Not Contain Button invalid - Run Keyword And Expect Error Page should not have contained input 'Act!' Page Should Not Contain Button Act! + [Documentation] Page Should Not Contain Button In Input Tag + [Setup] Go To Page "forms/buttons.html" + Page Should Not Contain Button invalid + Run Keyword And Expect Error Page should not have contained input 'Act!' + ... Page Should Not Contain Button Act! Get All Links - [Setup] Go To Page "links.html" - ${links}= Get All Links - Length Should Be ${links} 19 - List Should Contain Value ${links} bold_id + [Documentation] Get All Links + [Setup] Go To Page "links.html" + ${links}= Get All Links + Length Should Be ${links} 19 + List Should Contain Value ${links} bold_id Xpath Should Match X Times - [Setup] Go To Page "forms/login.html" - Xpath Should Match X Times //input[@type="text"] 1 - Xpath Should Match X Times //input[@type="text"] ${1} - Run Keyword And Expect Error Xpath //input[@type="text"] should have matched 2 times but matched 1 times Xpath Should Match X Times //input[@type="text"] 2 + [Documentation] Xpath Should Match X Times + [Setup] Go To Page "forms/login.html" + Xpath Should Match X Times //input[@type="text"] 1 + Xpath Should Match X Times //input[@type="text"] ${1} + Run Keyword And Expect Error + ... Xpath //input[@type="text"] should have matched 2 times but matched 1 times + ... Xpath Should Match X Times //input[@type="text"] 2 Locator Should Match X Times - [Setup] Go To Page "links.html" - Locator Should Match X Times link=Link 2 - Locator Should Match X Times link=Missing Link 0 + [Documentation] Locator Should Match X Times + [Setup] Go To Page "links.html" + Locator Should Match X Times link=Link 2 + Locator Should Match X Times link=Missing Link 0 diff --git a/test/acceptance/keywords/cookies.robot b/test/acceptance/keywords/cookies.robot index e39a64b4c..902d46fde 100644 --- a/test/acceptance/keywords/cookies.robot +++ b/test/acceptance/keywords/cookies.robot @@ -1,4 +1,5 @@ *** Setting *** +Documentation Tests cookies Suite Setup Go To Page "cookies.html" Suite Teardown Delete All Cookies Test Setup Add Cookies @@ -6,38 +7,48 @@ Resource ../resource.robot *** Test Cases *** Get Cookies + [Documentation] Get Cookies ${cookies}= Get Cookies - Should Match Regexp ${cookies} ^(test=seleniumlibrary; another=value)|(another=value; test=seleniumlibrary)$ + Should Match Regexp ${cookies} + ... ^(test=seleniumlibrary; another=value)|(another=value; test=seleniumlibrary)$ Get Cookie Value Set By Selenium + [Documentation] Get Cookie Value Set By Selenium ${value}= Get Cookie Value another Should Be Equal ${value} value Get Cookie Value Set By App + [Documentation] Get Cookie Value Set By App Click Link Add cookie ${cookie}= Get Cookie Value spam Should Be Equal ${cookie} eggs App Sees Cookie Set By Selenium + [Documentation] App Sees Cookie Set By Selenium Add Cookie setbyselenium true Click Link Check cookie Element Text Should Be output Cookie found with value 'true'! Delete Cookie + [Documentation] Delete Cookie Delete Cookie test ${cookies} = Get Cookies Should Be Equal ${cookies} another=value Non-existent Cookie - Run Keyword And Expect Error ValueError: Cookie with name missing not found. Get Cookie Value missing + [Documentation] Non-existent Cookie + Run Keyword And Expect Error ValueError: Cookie with name missing not found. + ... Get Cookie Value missing Get Cookies When There Are None + [Documentation] Get Cookies When There Are None Delete All Cookies ${cookies}= Get Cookies Should Be Equal ${cookies} ${EMPTY} *** Keyword *** Add Cookies + [Documentation] Add Cookies Delete All Cookies Add Cookie test seleniumlibrary Add Cookie another value diff --git a/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot b/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot index b3f22830d..78e72dfa0 100644 --- a/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot +++ b/test/acceptance/keywords/element_should_be_enabled_and_disabled.robot @@ -1,53 +1,67 @@ *** Settings *** -Test Setup Go To Page "forms/enabled_disabled_fields_form.html" -Resource ../resource.robot +Documentation Tests disabled elements +Test Setup Go To Page "forms/enabled_disabled_fields_form.html" +Resource ../resource.robot *** Test Cases *** Input Text - Should Be Enabled Not Disabled enabled_input - Should Be Disabled Not Enabled readonly_input - Should Be Disabled Not Enabled disabled_input + [Documentation] Input Text + Should Be Enabled Not Disabled enabled_input + Should Be Disabled Not Enabled readonly_input + Should Be Disabled Not Enabled disabled_input Input Password - Should Be Enabled Not Disabled enabled_password - Should Be Disabled Not Enabled readonly_password - Should Be Disabled Not Enabled disabled_password + [Documentation] Input Password + Should Be Enabled Not Disabled enabled_password + Should Be Disabled Not Enabled readonly_password + Should Be Disabled Not Enabled disabled_password Input Button - Should Be Enabled Not Disabled enabled_input_button - Should Be Disabled Not Enabled disabled_input_button + [Documentation] Input Button + Should Be Enabled Not Disabled enabled_input_button + Should Be Disabled Not Enabled disabled_input_button Textarea - Should Be Enabled Not Disabled enabled_textarea - Should Be Disabled Not Enabled readonly_textarea - Should Be Disabled Not Enabled disabled_textarea + [Documentation] Textarea + Should Be Enabled Not Disabled enabled_textarea + Should Be Disabled Not Enabled readonly_textarea + Should Be Disabled Not Enabled disabled_textarea Button - Should Be Enabled Not Disabled enabled_button - Should Be Disabled Not Enabled disabled_button + [Documentation] Button + Should Be Enabled Not Disabled enabled_button + Should Be Disabled Not Enabled disabled_button Option - Should Be Enabled Not Disabled enabled_option - Should Be Disabled Not Enabled disabled_option + [Documentation] Option + Should Be Enabled Not Disabled enabled_option + Should Be Disabled Not Enabled disabled_option Disabled with different syntaxes - Should Be Disabled Not Enabled disabled_only - Should Be Disabled Not Enabled disabled_with_equals_sign - Should Be Disabled Not Enabled disabled_empty - Should Be Disabled Not Enabled disabled_invalid_value + [Documentation] Disabled with different syntaxes + Should Be Disabled Not Enabled disabled_only + Should Be Disabled Not Enabled disabled_with_equals_sign + Should Be Disabled Not Enabled disabled_empty + Should Be Disabled Not Enabled disabled_invalid_value Not Input nor Editable Element - Run Keyword And Expect Error ERROR: Element table1 is not an input. Element Should Be Enabled table1 - Run Keyword And Expect Error ERROR: Element table1 is not an input. Element Should Be Disabled table1 + [Documentation] Not Input nor Editable Element + Run Keyword And Expect Error ERROR: Element table1 is not an input. + ... Element Should Be Enabled table1 + Run Keyword And Expect Error ERROR: Element table1 is not an input. + ... Element Should Be Disabled table1 *** Keywords *** Should Be Enabled Not Disabled - [Arguments] ${locator} - Element Should Be Enabled ${locator} - Run Keyword And Expect Error Element '${locator}' is enabled. Element Should Be Disabled ${locator} + [Documentation] Should Be Enabled Not Disabled + [Arguments] ${locator} + Element Should Be Enabled ${locator} + Run Keyword And Expect Error Element '${locator}' is enabled. + ... Element Should Be Disabled ${locator} Should Be Disabled Not Enabled - [Arguments] ${locator} - Element Should Be Disabled ${locator} - Run Keyword And Expect Error Element '${locator}' is disabled. Element Should Be Enabled ${locator} - + [Documentation] Should Be Disabled Not Enabled + [Arguments] ${locator} + Element Should Be Disabled ${locator} + Run Keyword And Expect Error Element '${locator}' is disabled. + ... Element Should Be Enabled ${locator} diff --git a/test/acceptance/keywords/elements.robot b/test/acceptance/keywords/elements.robot index 4e7c731f1..660f708be 100644 --- a/test/acceptance/keywords/elements.robot +++ b/test/acceptance/keywords/elements.robot @@ -1,54 +1,71 @@ *** Settings *** -Test Setup Go To Page "links.html" -Resource ../resource.robot +Documentation Tests elements +Test Setup Go To Page "links.html" +Resource ../resource.robot *** Test Cases *** Get Elements - @{links}= Get WebElements //div[@id="div_id"]/a - Length Should Be ${links} 11 + [Documentation] Get Elements + @{links}= Get WebElements //div[@id="div_id"]/a + Length Should Be ${links} 11 + +Get Web Element + [Documentation] Get Web Element + @{links}= Get WebElements //div[@id="div_id"]/a + ${link}= Get WebElement //div[@id="div_id"]/a + Should Be Equal @{links}[0] ${link} + Run Keyword and Expect Error + ... ValueError: Element locator 'id=non_existing_elem' did not match any elements. + ... Get WebElement id=non_existing_elem More Get Elements - [Setup] Go To Page "forms/prefilled_email_form.html" - @{checkboxes}= Get WebElements //input[@type="checkbox"] - Length Should Be ${checkboxes} 2 - :For ${checkbox} in @{checkboxes} - \ Unselect Checkbox ${checkbox} - :For ${checkbox} in @{checkboxes} - \ Checkbox Should Not Be Selected ${checkbox} - :For ${checkbox} in @{checkboxes} - \ Select Checkbox ${checkbox} - :For ${checkbox} in @{checkboxes} - \ Checkbox Should Be Selected ${checkbox} + [Documentation] More Get Elements + [Setup] Go To Page "forms/prefilled_email_form.html" + @{checkboxes}= Get WebElements //input[@type="checkbox"] + Length Should Be ${checkboxes} 2 + : FOR ${checkbox} IN @{checkboxes} + \ Unselect Checkbox ${checkbox} + : FOR ${checkbox} IN @{checkboxes} + \ Checkbox Should Not Be Selected ${checkbox} + : FOR ${checkbox} IN @{checkboxes} + \ Select Checkbox ${checkbox} + : FOR ${checkbox} IN @{checkboxes} + \ Checkbox Should Be Selected ${checkbox} Assign Id To Element - [Documentation] Tests also Reload Page keyword. - Page Should Not Contain Element my id - Assign ID to Element xpath=//div[@id="first_div"] my id - Page Should Contain Element my id + [Documentation] Tests also Reload Page keyword. + Page Should Not Contain Element my id + Assign ID to Element xpath=//div[@id="first_div"] my id + Page Should Contain Element my id Reload Page - Page Should Not Contain Element my id + Page Should Not Contain Element my id Get Element Attribute - ${id}= Get Element Attribute link=Link with id@id - Should Be Equal ${id} some_id - ${id}= Get Element Attribute dom=document.getElementsByTagName('a')[3]@id - Should Be Equal ${id} some_id - ${class}= Get Element Attribute second_div@class - Should Be Equal ${class} Second Class + [Documentation] Get Element Attribute + ${id}= Get Element Attribute link=Link with id@id + Should Be Equal ${id} some_id + ${id}= Get Element Attribute dom=document.getElementsByTagName('a')[3]@id + Should Be Equal ${id} some_id + ${class}= Get Element Attribute second_div@class + Should Be Equal ${class} Second Class Get Matching XPath Count - ${count}= Get Matching XPath Count //a - Should Be Equal ${count} 19 - ${count}= Get Matching XPath Count //div[@id="first_div"]/a - Should Be Equal ${count} 2 + [Documentation] Get Matching XPath Count + ${count}= Get Matching XPath Count //a + Should Be Equal ${count} 19 + ${count}= Get Matching XPath Count //div[@id="first_div"]/a + Should Be Equal ${count} 2 Get Horizontal Position - ${pos}= Get Horizontal Position link=Link - Should Be True ${pos} > ${0} - Run Keyword And Expect Error Could not determine position for 'non-existent' Get Horizontal Position non-existent + [Documentation] Get Horizontal Position + ${pos}= Get Horizontal Position link=Link + Should Be True ${pos} > ${0} + Run Keyword And Expect Error Could not determine position for 'non-existent' + ... Get Horizontal Position non-existent Get Vertical Position - ${pos}= Get Vertical Position link=Link - Should Be True ${pos} > ${0} - Run Keyword And Expect Error Could not determine position for 'non-existent' Get Horizontal Position non-existent - + [Documentation] Get Vertical Position + ${pos}= Get Vertical Position link=Link + Should Be True ${pos} > ${0} + Run Keyword And Expect Error Could not determine position for 'non-existent' + ... Get Horizontal Position non-existent diff --git a/test/acceptance/keywords/forms_and_buttons.robot b/test/acceptance/keywords/forms_and_buttons.robot index e388e9920..aac4a7444 100644 --- a/test/acceptance/keywords/forms_and_buttons.robot +++ b/test/acceptance/keywords/forms_and_buttons.robot @@ -1,75 +1,86 @@ *** Settings *** -Test Setup Go To Page "forms/named_submit_buttons.html" -Resource ../resource.robot -Library OperatingSystem - +Documentation Tests forms and buttons +Test Setup Go To Page "forms/named_submit_buttons.html" +Resource ../resource.robot +Library OperatingSystem *** Variables *** -${FORM SUBMITTED} forms/submit.html - +${FORM SUBMITTED} forms/submit.html *** Test Cases *** Submit Form - [Documentation] LOG 2 Submitting form 'form_name'. - Submit Form form_name + [Documentation] LOG 2 Submitting form 'form_name'. + Submit Form form_name Verify Location Is "${FORM SUBMITTED}" Submit Form Without Args - [Setup] Go To Page "forms/form_without_name.html" + [Documentation] Submit Form Without Args + [Setup] Go To Page "forms/form_without_name.html" Submit Form Verify Location Is "target/first.html" Click Ok Button By Name - [Documentation] LOG 2 Clicking button 'ok_button'. - Click Button ok_button + [Documentation] LOG 2 Clicking button 'ok_button'. + Click Button ok_button Verify Location Is "${FORM SUBMITTED}" Click Cancel Button By Name - Click Button cancel_button + [Documentation] Click Cancel Button By Name + Click Button cancel_button Value Should Be Cancel Click Ok Button By Value - Click Button Ok + [Documentation] Click Ok Button By Value + Click Button Ok Verify Location Is "${FORM SUBMITTED}" Click Cancel Button By Value - Click Button Cancel + [Documentation] Click Cancel Button By Value + Click Button Cancel Value Should Be Cancel Click button created with