i´ve tried to run python test automation script using my own device (samsung note 2) with Appium server (v 1.7.2)
I¨ve installed: + python 2.7.14 + appium server 1.7.2 + python appium server
here´s my code:
import os
import unittest
from appium import webdriver
from time import sleep
class AndroidTests(unittest.TestCase):
"Class to run tests against Banco Galicia app"
#print os.path.abspath(os.path.join(os.path.dirname(__file__)
def setUp(self):
"Setup for the test"
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = 'adf70dc728bcbf33'
# Returns abs path relative to this file and not cwd
desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'app-all_environment-debug_6_11_10.apk'))
desired_caps['appPackage'] = 'ar.com.galicia.app.all_environment'
desired_caps['appActivity'] = 'ar.com.galicia.switcher.activities.SwitcherActivity'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
def tearDown(self):
"Tear down the test"
self.driver.quit()
def test_homologacion(self):
"Test HOMOLOGACION"
element = self.driver.find_element_by_name("HOMOLOGACION")
element.click()
#self.driver.find_element_by_name("Single Player").click()
#textfields = self.driver.find_elements_by_class_name("android.widget.TextView")
#self.assertEqual('MATCH SETTINGS', textfields[0].text)
#---START OF SCRIPT
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(AndroidTests)
unittest.TextTestRunner(verbosity=2).run(suite)
The Appium server output error is:
[2018-03-08 02:26:23][Appium] Welcome to Appium v1.6.4
[2018-03-08 02:26:23][Appium] Non-default server args:
[2018-03-08 02:26:23][Appium] address: 127.0.0.1
[2018-03-08 02:26:23][Appium] logTimestamp: true
[2018-03-08 02:26:23][Appium] localTimezone: true
[2018-03-08 02:26:23][Appium] Appium REST http interface listener started on 127.0.0.1:4723
[2018-03-08 02:26:27][HTTP] --> POST /wd/hub/session {“capabilities”:{“firstMatch”:[{}],“alwaysMatch”:{“platformName”:“Android”}},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“4.4.2”,“deviceName”:“4df70dc728bcbf33”,“appPackage”:“ar.com.galicia.app.all_environment”,“appActivity”:“ar.com.galicia.switcher.activities.SwitcherActivity”}}
[2018-03-08 02:26:27][MJSONWP] Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“platformVersion”:“4.4.2”,“deviceName”:“4df70dc728bcbf33”,“appPackage”:“ar.com.galicia.app.all_environment”,“appActivity”:“ar.com.galicia.switcher.activities.SwitcherActivity”},null,{“firstMatch”:[{}],“alwaysMatch”:{“platformName”:“Android”}},null,null]
[2018-03-08 02:26:27][BaseDriver] Event ‘newSessionRequested’ logged at 1520529987096 (14:26:27 GMT-0300 (Hora estándar de Argentina))
[2018-03-08 02:26:27][Appium] Creating new AndroidDriver (v1.17.1) session
[2018-03-08 02:26:27][Appium] Capabilities:
[2018-03-08 02:26:27][Appium] platformName: ‘Android’
[2018-03-08 02:26:27][Appium] platformVersion: ‘4.4.2’
[2018-03-08 02:26:27][Appium] deviceName: ‘4df70dc728bcbf33’
[2018-03-08 02:26:27][Appium] appPackage: ‘ar.com.galicia.app.all_environment’
[2018-03-08 02:26:27][Appium] appActivity: ‘ar.com.galicia.switcher.activities.SwitcherActivity’
[2018-03-08 02:26:27][AndroidDriver] AndroidDriver version: 1.17.1
[2018-03-08 02:26:27][BaseDriver] Session created with session id: 41695e41-d028-4076-ad6c-d687ab04e5f7
[2018-03-08 02:26:27][AndroidDriver] Getting Java version
[2018-03-08 02:26:27][AndroidDriver] Java version is: 1.8.0_161
[2018-03-08 02:26:27][ADB] Checking whether adb is present
[2018-03-08 02:26:27][AndroidDriver] Shutting down Android driver
[2018-03-08 02:26:27][AndroidDriver] Called deleteSession but bootstrap wasn’t active
[2018-03-08 02:26:27][MJSONWP] Encountered internal error running command: Error: ENOENT: no such file or directory, scandir 'C:\Program Files\Android\Android Studio;C:\Program Files\Android\Android Studio\jre;C:\androidStudio\build-tools’
at Error (native)
[2018-03-08 02:26:27][HTTP] <-- POST /wd/hub/session 500 177 ms - 303
Thanks!