35 self.
infoinfo(
"Submitting form '%s'." % locator)
38 element = self.
find_elementfind_element(locator, tag=
'form')
48 self.
infoinfo(
"Verifying checkbox '%s' is selected." % locator)
50 if not element.is_selected():
51 raise AssertionError(
"Checkbox '%s' should have been selected "
52 "but was not." % locator)
61 self.
infoinfo(
"Verifying checkbox '%s' is not selected." % locator)
63 if element.is_selected():
64 raise AssertionError(
"Checkbox '%s' should not have been "
65 "selected." % locator)
100 self.
infoinfo(
"Selecting checkbox '%s'." % locator)
102 if not element.is_selected():
114 self.
infoinfo(
"Unselecting checkbox '%s'." % locator)
116 if element.is_selected():
152 self.
infoinfo(
"Verifying radio button '%s' has selection '%s'."
153 % (group_name, value))
156 if actual_value
is None or actual_value != value:
157 raise AssertionError(
"Selection of radio button '%s' should have "
158 "been '%s' but was '%s'."
159 % (group_name, value, actual_value))
167 self.
infoinfo(
"Verifying radio button '%s' has no selection." % group_name)
170 if actual_value
is not None:
171 raise AssertionError(
"Radio button group '%s' should not have "
172 "had selection, but '%s' was selected."
173 % (group_name, actual_value))
188 self.
infoinfo(
"Selecting '%s' from radio button '%s'."
189 % (value, group_name))
191 if not element.is_selected():
210 if not os.path.isfile(file_path):
211 raise ValueError(
"File '%s' does not exist on the local file "
212 "system." % file_path)
213 self.
find_elementfind_element(locator).send_keys(file_path)
241 self.
infoinfo(
"Typing password into text field '%s'." % locator)
259 self.
infoinfo(
"Typing text '%s' into text field '%s'." % (text, locator))
295 actual = self.
_get_value_get_value(locator,
'text field')
296 if expected
not in actual:
298 message =
"Text field '%s' should have contained text '%s' "\
299 "but it contained '%s'." % (locator, expected, actual)
300 raise AssertionError(message)
301 self.
infoinfo(
"Text field '%s' contains text '%s'." % (locator, expected))
312 actual = self.
_get_value_get_value(locator,
'text field')
313 if actual != expected:
315 message =
"Value of text field '%s' should have been '%s' "\
316 "but was '%s'." % (locator, expected, actual)
317 raise AssertionError(message)
318 self.
infoinfo(
"Content of text field '%s' is '%s'." % (locator, expected))
329 actual = self.
_get_value_get_value(locator,
'text area')
330 if expected
not in actual:
332 message =
"Text area '%s' should have contained text '%s' " \
333 "but it had '%s'." % (locator, expected, actual)
334 raise AssertionError(message)
335 self.
infoinfo(
"Text area '%s' contains text '%s'." % (locator, expected))
346 actual = self.
_get_value_get_value(locator,
'text area')
347 if expected != actual:
349 message =
"Text area '%s' should have had text '%s' " \
350 "but it had '%s'." % (locator, expected, actual)
351 raise AssertionError(message)
352 self.
infoinfo(
"Content of text area '%s' is '%s'." % (locator, expected))
367 except AssertionError:
385 return self.
find_elementfind_element(locator, tag).get_attribute(
'value')
388 return self.
find_elementfind_element(locator, tag=
'checkbox')
391 xpath =
"xpath://input[@type='radio' and @name='%s']" % group_name
392 self.
debugdebug(
'Radio group locator: ' + xpath)
400 xpath =
"xpath://input[@type='radio' and @name='%s' and " \
401 "(@value='%s' or @id='%s')]" % (group_name, value, value)
402 self.
debugdebug(
'Radio group locator: ' + xpath)
405 except ElementNotFound:
407 "value '%s' found." % (group_name, value))
410 for element
in elements:
411 if element.is_selected():
412 return element.get_attribute(
'value')
419 element.send_keys(text)
def find_element(self, locator, tag=None, required=True, parent=None)
Find element matching locator.
def find_elements(self, locator, tag=None, parent=None)
Find all elements matching locator.
def debug(self, msg, html=False)
def assert_page_not_contains(self, locator, tag=None, message=None, loglevel='TRACE')
def info(self, msg, html=False)
def assert_page_contains(self, locator, tag=None, message=None, loglevel='TRACE')