Appium driver not initializing
See original GitHub issueWhile running code getting stuck at driver = webdriver.Remote(“http://127.0.0.1:4723/wd/hub”, desired_cap) and then nothing happen, code goes in dead lock.
Environment
- Appium version: v1.17.0
- Desktop OS/version used to run Appium: Win 10
- Mobile platform/version under test: Pixel 3 XL Nauget
- Real device or emulator/simulator: emulator
- Appium CLI or Appium.app|exe: Appium CLI
Details
Code is working fine when i manually start the appium server from cmd but when trying to do it via AppiumService get’s stuck in processing at driver = webdriver.Remote() without any error or warning, and nothing happen on device.
import logging
from appium.webdriver.appium_service import AppiumService
from appium import webdriver
logger = logging.getLogger('framework')
FATEL_APPIUM_SERVER_ERROR = "fatal appium error while python tries to communicate with appium over HTTP." \
"could be caused by resources constraints or due to failure of Python appium client" \
"library."
class Mobile_adapter:
def __init__(self):
self._appium_Service = AppiumService()
self.active_Server = None
def start_Server(self):
"""initiates appium server and returns it's status as true or false"""
max_retries = 0
self.active_Server = self._appium_Service.start(args=['--log-timestamp', '--log', 'C:/Users/vsingh/AppData/Roaming/Appium/logs/appium.log'])
while self._appium_Service.is_running is False and max_retries != 3:
self._appium_Service.start(args=args=['--log-timestamp', '--log', 'C:/Users/vsingh/AppData/Roaming/Appium/logs/appium.log'])
max_retries += 1
if max_retries == 3:
raise Exception(FATEL_APPIUM_SERVER_ERROR)
logger.info('Appium server up and running')
def kill_server(self):
# self.active_Server.stop()
self._appium_Service.stop()
status = self._appium_Service.is_running
return status
if __name__ == "__main__":
m = Mobile_adapter()
m.start_Server()
path = "C:\\application.apk"
desired_cap = {"platformName": "Android", "deviceName": "emulator-5554",
"app": path, "noReset": "True",
"appWaitActivity": "LoginActivity", "appWaitPackage": "appPackage"}
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_cap)
import time
time.sleep(10)
Server Logs
2020-05-06 06:06:14:957 [Appium] Welcome to Appium v1.17.0 2020-05-06 06:06:14:958 [Appium] Non-default server args: 2020-05-06 06:06:14:958 [Appium] logFile: C:/Users/vsingh/AppData/Roaming/Appium/logs/appium.log 2020-05-06 06:06:14:959 [Appium] logTimestamp: true 2020-05-06 06:06:14:990 [Appium] Appium REST http interface listener started on 0.0.0.0:4723 2020-05-06 06:06:15:477 [HTTP] --> HEAD /wd/hub/status 2020-05-06 06:06:15:477 [HTTP] {} 2020-05-06 06:06:15:481 [GENERIC] Calling AppiumDriver.getStatus() with args: [] 2020-05-06 06:06:15:483 [GENERIC] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.17.0”}} 2020-05-06 06:06:15:489 [HTTP] <-- HEAD /wd/hub/status 200 10 ms - 68 2020-05-06 06:06:15:489 [HTTP] 2020-05-06 06:06:17:553 [HTTP] --> POST /wd/hub/session
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (2 by maintainers)
Top GitHub Comments
@ki4070ma Thanks mate, for know this solution is working fine on windows, can you please tell me is there any alternate for sp.DEVNULL in MacOS x or this will work on both platform, untill concrete solution gets available.
https://pypi.org/project/Appium-Python-Client/1.0.2/ includes 552