def wait(string=None): if (string in BUTTON): if (string in BUTTON[:6] or string == 'Add an Item'): sleep(1) WebDriverWait(driver,999).until(EC.presence_of_element_located( (By.XPATH, "//body[@class='o_web_client']"))) wait_until(Button(string).exists,999) else: wait_until(Text(string).exists,999)
def test_find_all_non_existent_button(self): self.assertEqual([], find_all(Button("Non-existent Button")))
def test_button_tag_button_exists(self): self.assertTrue(Button("Button tag without type").exists())
def test_button_no_text(self): self.assertEqual(2, len(find_all(Button(to_right_of='Row 1'))))
def test_enabled_button(self): self.assertIs(True, Button("Enabled Button").is_enabled())
def test_button_not_exists(self): self.assertFalse(Button("Nonexistent Button").exists())
def test_submit_button_exists_lower_case(self): self.assertTrue(Button("submit button").exists())
def test_button_exists(self): self.assertTrue(Button("Enabled Button").exists())
def test_doubleclick_top_left(self): doubleclick(Button("Button 1").top_left) self.assert_result_is("Button 1 doubleclicked at offset (0, 0).", offset_delta=(1, 1))
def test_rightclick_top_left_offset(self): rightclick(Button("Button 3").top_left + (3, 4)) self.assert_result_is("Button 3 rightclicked at offset (3, 4).")
def test_hover_top_left_offset(self): hover(Button("Button 3").top_left + (3, 4)) self.assert_result_is("Button 3 hovered at offset (3, 4).")
def test_hover_top_left(self): hover(Button("Button 1").top_left) self.assert_result_is("Button 1 hovered at offset (0, 0).", offset_delta=(1, 1))
def test_top_left(self): self.assert_is_in_range(Point(2, 3), Button("Button 1").top_left, delta=(0, 1))
def test_find_all_duplicate_button_to_right_of(self): self.assertEqual( 2, len(find_all(Button("Duplicate Button", to_right_of="Row 1"))) )
def test_find_all_duplicate_button(self): self.assertEqual(4, len(find_all(Button("Duplicate Button"))))
def test_aria_label_submit_button_exists(self): self.assertTrue(Button("Submit").exists())
def test_aria_label_button_exists(self): self.assertTrue(Button("Close").exists())
def test_doubleclick_top_left_offset(self): doubleclick(Button("Button 3").top_left + (3, 4)) self.assert_result_is("Button 3 doubleclicked at offset (3, 4).")
def test_submit_button_exists(self): self.assertTrue(Button("Submit Button").exists())
def test_aria_label_button_is_enabled(self): self.assertTrue(Button("Close").is_enabled())
def test_input_button_exists(self): self.assertTrue(Button("Input Button").exists())
def test_aria_label_disabled_button_is_enabled(self): self.assertFalse(Button("Disabled Close").is_enabled())
def test_text_field_does_not_exist_as_button(self): self.assertFalse(Button("Example Text Field").exists())
def test_aria_label_non_existent_button(self): self.assertFalse(Button("This doesnt exist").exists())
def test_disabled_button(self): self.assertFalse(Button("Disabled Button").is_enabled())
def test_aria_label_div_button_exists(self): self.assertTrue(Button("Attach files").exists())
def test_div_button_exists(self): self.assertTrue(Button("DIV with role=button").exists())
def test_aria_label_div_button_is_enabled(self): self.assertTrue(Button("Attach files").is_enabled())
def test_submit_button_can_be_found_by_title(self): self.assertTrue(Button("submitButtonTitle").exists())
def test_aria_label_div_disabled_button_is_enabled(self): self.assertFalse(Button("Disabled Attach files").is_enabled())