def test_click(self): self.driver.get("http://sahitest.com/demo/clicks.htm") element_click = self.driver.find_element_by_xpath( "//input[@value = 'click me']") element_duble_click = self.driver.find_element_by_xpath( "//input[@value = 'dbl click me']") element_dright_click = self.driver.find_element_by_xpath( "//input[@value = 'right click me']") action = ActionChains(self.driver) action.click(element_click) action.double_click(element_duble_click) action.context_click(element_dright_click) action.perform()
def test_case_click(self): self.driver.get("http://sahitest.com/demo/clicks.htm") #双击 dbl_click_element = self.driver.find_element( By.XPATH, '//input[@value="dbl click me"]') #单机 click_element = self.driver.find_element(By.XPATH, '//input[@value="click me"]') #右击 right_click_element = self.driver.find_element( By.XPATH, '//input[@value="right click me"]') action = ActionChains(self.driver) #鼠标单击 action.click(click_element) #鼠标双击 action.double_click(dbl_click_element) #鼠标右击 action.context_click(right_click_element) sleep(3) action.perform() sleep(3)
def jump(self, x, y): action.click(x, y)
def click(self, x, y): action.click(x, y)
def sign_in(self): action.click(self.sigin_x, self.sigin_y, 3)
def click_sign(self): action.click(self.sign_btn_x, self.sign_btn_y)
def click_my(self): action.click(self.my_x, self.my_y)