def test_switch_to_search_text_field(self): write("Main window", into="Text field") self.assertEqual("Main window", TextField("Text field").value) self._open_popup() write("Popup", into="Text field") self.assertEqual("Popup", TextField("Text field").value) switch_to("test_window_handling - Main") self.assertEqual("Main window", TextField("Text field").value)
def test_interact_with_found_elements(self): all_tfs = find_all(TextField()) example_tf = None for text_field in all_tfs: try: id_ = text_field.web_element.get_attribute('id') except StaleElementReferenceException: # This may happen for found web elements in different iframes. # TODO: Improve this, eg. by adding a .getId() property to # TextField (/HTMLElement) which handles this problem. pass else: if id_ == 'exampleTextFieldId': example_tf = text_field self.assertIsNotNone(example_tf) write("test_interact_with_found_elements", into=example_tf) self.assertEqual( "test_interact_with_found_elements", TextField("Example Text Field").value )
def test_empty_text_field_value(self): self.assertEqual('', TextField("Empty Text Field").value)
def test_text_field_with_placeholder_exists(self): self.assertIs(True, TextField("Placeholder Text Field").exists())
def test_text_field_is_enabled_false(self): self.assertFalse(TextField("Disabled Text Field").is_enabled())
def test_text_field_is_editable(self): self.assertTrue(TextField("Example Text Field").is_editable())
def test_text_field_not_exists(self): self.assertFalse(TextField("Nonexistent TextField").exists())
def test_text_field_lower_case_exists(self): self.assertIs(True, TextField("example text field").exists())
def test_read_german_text_field(self): self.assertEqual('Heizölrückstoßabdämpfung', TextField("Deutsch").value)
def test_read_disabled_text_field(self): self.assertEqual('This is disabled', TextField("Disabled Text Field").value)
def test_write(self): write("Hello World!") self.assertEqual( "Hello World!", TextField('Autofocus text field').value )
def test_write_into_text_field_to_right_of(self): write("Hi there!", into=(TextField(to_right_of='Normal text field'))) self.assertEqual("Hi there!", TextField('Normal text field').value)
def test_write_into(self): write("Hi there!", into='Normal text field') self.assertEqual("Hi there!", TextField('Normal text field').value)
def test_aria_textbox_value(self): self.assertEqual("Textbox value", TextField("Textbox").value)
def test_aria_textbox_exists(self): self.assertTrue(TextField("Textbox").exists())
def test_text_field_combo_box_with_same_name(self): text_field = TextField("Language") combo_box = ComboBox("Language") self.assertNotEqual(text_field.y, combo_box.y)
def test_text_field_exists(self): self.assertIs(True, TextField("Example Text Field").exists())
def test_text_field_input_type_upper_case_text(self): self.assertTrue(TextField('Input type=Text').exists())
def test_text_field_in_second_col_exists(self): self.assertIs(True, TextField("Another Text Field").exists())
def test_write_into_labelled_text_field(self): write('Some text', into='Labelled Text Field') self.assertEqual('Some text', TextField('Labelled Text Field').value)
def test_text_field_is_editable_false(self): self.assertIs(False, TextField("ReadOnly Text Field").is_editable())
def test_required_text_field_marked_with_asterisk_exists(self): self.assertIs(True, TextField("Required Text Field").exists())
def test_text_field_is_enabled(self): self.assertIs(True, TextField("Example Text Field").is_enabled())
def test_text_field_labelled_by_free_text(self): self.assertEqual("TF labelled by free text", TextField("Text field labelled by free text").value)
def test_text_field_value(self): self.assertEqual("Lorem ipsum", TextField("Example Text Field").value)
def test_input_type_tel(self): self.assertFindsEltWithId(TextField("Input type=tel"), "inputTypeTel")
def test_text_field_no_type_specified_with_placeholder_exists(self): self.assertIs( True, TextField("Placeholder Text Field without type").exists())
def test_text_field_to_right_of_text_field(self): self.assertFindsEltWithId( TextField(to_right_of=TextField("Required Text Field")), "inputTypeTel")
def test_read_readonly_text_field(self): self.assertEqual('This is read only', TextField("ReadOnly Text Field").value)
def test_contenteditable_paragrapth(self): self.assertFindsEltWithId(TextField("contenteditable Paragraph"), "contenteditableParagraphId")