1

I tried to run an Appium test case (python) via Pycharm to automated test case on Wearable device. Source code below:

import time
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions


class Untitled(unittest.TestCase):
    reportDirectory = 'reports'
    reportFormat = 'xml'
    dc = {}
    testName = 'Untitled'
    driver = None

    def setUp(self):
        self.dc['reportDirectory'] = self.reportDirectory
        self.dc['reportFormat'] = self.reportFormat
        self.dc['testName'] = self.testName
        self.dc['appPackage'] = 'com.fossil.phone'
        self.dc['udid'] = 'C3E9244E0238'
        self.dc['platformName'] = 'android'
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', self.dc)

    def testUntitled(self):
        self.driver.press_keycode(3)  # home
        self.driver.press_keycode(3)  # home
        self.driver.find_element_by_xpath("xpath=//*[@id='icon' and ./parent::*[(./preceding-sibling::* | ./following-sibling::*)[./*[./*[@text='Phone']]]]]").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='Contacts']").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='Testing Contact']").click()
        self.driver.press_keycode(3)  # home

    def tearDown(self):
        self.driver.quit()

    if __name__ == '__main__':
        unittest.main()

And this is the error message :

Launching unittests with arguments python -m unittest Untitled.Untitled in /Users/nhchung/PycharmProjects/MetQua


Error
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
    yield
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: pkg, and activity or intent action, are required to start an application



Assertion failed
/usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py:704: ResourceWarning: unclosed <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 64654), raddr=('127.0.0.1', 4723)>
  outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback


Ran 1 test in 11.614s

FAILED (errors=1)

Process finished with exit code 1


Try many ways but I can not resolve this one. What should I do now? I also start appium server before running test case.

  • It does appear to be benign, a resource leak in the drivers, same warning seen on my environment. No side effects thus far noted. –  Sep 28 '20 at 12:51

0 Answers0