2016-11-24 40 views
2

同じ行に「目」がありますが、別のIDを見つけることができないため、「パスワード」スペースを長くクリックする方法が必要です。しかし私が書いたプログラムは長いクリックをしていない。私のコードを修正してください:Pythonの長いクリック

def testDevice1(self): 
    time.sleep(5) 


    username=self.driver.find_element_by_id('com.eas.android:id/front_edit') 
    username.send_keys('[email protected]') 
    time.sleep(5) 
    password = self.driver.find_element_by_id('com.eas.android:id/password') 
    password.send_keys('111111') 
    time.sleep(5) 
    self.driver.longClick('com.eas.android:id/password') 
    time.sleep(10) 
    self.driver.save_screenshot('/home/nat/PycharmProjects/touchoneautomation/appiumTests/screenshots/shot1.png') 
    self.driver.find_element_by_id('com.eas.android:id/btn_login').click() 
    self.driver.save_screenshot('/home/nat/PycharmProjects/touchoneautomation/appiumTests/screenshots/shot1.1.png') 
    time.sleep(5) 
    self.driver.save_screenshot('/home/nat/PycharmProjects/touchoneautomation/appiumTests/screenshots/shot1.2.png') 
    self.driver.find_element_by_id("com.eas.android:id/panel_logout").click() 
    time.sleep(5) 

答えて

0

(Python)ルックアップTouchActionコマンドを一緒に文字列で入力することができます。

from appium.webdriver.common.touch_action import TouchAction 
ta = TouchAction(driver) 
ta.press(x=x, y=y).release().perform() 

# some_web_obj = driver.find... 
ta.press(some_web_obj).wait(duration_in_millisec).release().perform() 
関連する問題