question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium driver not initializing

See original GitHub issue

While 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:closed
  • Created 3 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vineetsingh065commented, May 7, 2020

@vineetsingh065 As short term solution on windows, you can resolve by below codes.

import subprocess as sp
self._appium_Service.start(stdout=sp.DEVNULL)

I could resolve below functional test case by above codes, but if you cannot resolve in your case, please let me know.

#534 (comment)

@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.

0reactions
KazuCocoacommented, Jul 15, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium driver not initializing - python - Stack Overflow
Code is working fine when i manually start the appium server from cmd but when trying to do it via AppiumService got get's...
Read more >
Unable to initialize driver using appium-java 8 - Support
Hi everyone, I'm trying to test the appium v8.0.0 but cannot initialize the driver correctly. Env: Java 11 appium server: 1.21.0
Read more >
Cannot initialize the appium driver - Support
I'm not able to start the appium driver (application gets instlled), I have tried with all the appium version starting from 1.3 to...
Read more >
Troubleshooting - Appium
General · Make sure you've followed the getting started steps in the README · Make sure your system is set up appropriately (i.e.,...
Read more >
Failing to initialize iOS driver when running Appium tests ...
I3002_RegisterUser_PasswordShouldHaveAtleastOneDigit:13453 Could not find a connected IOS device. org.openqa.selenium.WebDriverException: It is impossible ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found