1

I am using Python 3.7 with Appium 1.15.1 on real Android Device. When my script finish the job, I close the driver with these lines:

if p_driver:
    p_driver.close()

but I get this error ouput:

  File "C:\Users\Nino\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 688, in close
    self.execute(Command.CLOSE)
  File "C:\Users\Nino\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Nino\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
    raise wde
  File "C:\Users\Nino\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\errorhandler.py", line 24, in check_response
    super(MobileErrorHandler, self).check_response(response)
  File "C:\Users\Nino\AppData\Local\Programs\Python\Python37\lib\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: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 404 - undefined

I would like to understand what I am doing wrong? What is the way to close properly the driver? Can you help me please?

Gauthier Buttez
  • 1,005
  • 1
  • 16
  • 40

1 Answers1

0

Step1: you should get the appium session dictionary first:

session_instance = webdriver.Remote(str(url), caps_dic)

where url is your appium server url. something like: "http://127.0.0.1:4723/wd/hub" and caps_dic is a dictionary of all your desired capabilities

Step2: you run the quit() method on session:

session_instance[session].quit()

So the whole snippet is:

session_instance = webdriver.Remote(str(url), caps_dic)
session_instance[session].quit()