Ich spreche Spanisch, Entschuldigung für mein Englisch. Ich habe eine mobile App und möchte einen Automatisierungstest mit der aws-Gerätefarm durchführen. Ich bin auf einem Mac, ich versuche, einen einfachen Test auf meiner Android-App zu machen: Tippen Sie auf eine Login-Schaltfläche, geben Sie Benutzername und Passwort ein und loggen Sie sich dann ein. Ich verwende Appium, um einen Python-Code für meinen Test zu haben, dann lade ich meine .apk und eine Zip-Datei mit meinem Test auf aws hoch, aber es schlägt immer fehl. Ich bin neu mit Python, und ich konnte kein Beispiel finden, das mir hilft.Wie Python richtig zu automatisieren Test auf Amazon Web Services
Ich befolge alle Schritte auf http://docs.aws.amazon.com/es_es/devicefarm/latest/developerguide/test-types-android-appium-python.html, aber das Ausführen des Tests gibt nur fehlschlägt und keine Screenshots.
Dies ist der Py-Code:
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time
import os.path
import unittest
from selenium import webdriver
success = True
desired_caps = {}
desired_caps['appium-version'] = '1.0'
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '5.0.1'
desired_caps['app'] = os.path.abspath('/Users/developer/Documents/AWS/workspace/APK/Squeeze.apk')
desired_caps['appPackage'] = 'com.example.mkim.aut'
desired_caps['appActivity'] = 'com.example.mkim.aut.SuccessfulLogin'
wd = webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps)
wd.implicitly_wait(60)
screenshot_folder = os.getenv('SCREENSHOT_PATH', '')
wd.save_screenshot(screenshot_folder + "/screenshot.png")
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
try:
#self.driver.save_screenshot(screenshot_folder + "/screenshot.png")
wd.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 666, "y": 1519 })
wd.save_screenshot(screenshot_folder + "/screenshot1.png")
wd.find_element_by_xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]").click()
wd.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 121, "y": 726 })
wd.find_element_by_name("(null)").send_keys("[email protected]")
wd.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 191, "y": 919 })
wd.find_element_by_name("(null)").send_keys("Password")
wd.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 563, "y": 1079 })
except:
wd.quit()
if not success:
raise Exception("Test failed.")
Ya visitaste [stackoverflow en español] (http://es.stackoverflow.com)? –