How to close driver properly?


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

if p_driver:

but I get this error ouput:

  File "C:\Users\Nino\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\", line 688, in close
  File "C:\Users\Nino\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\", line 321, in execute
  File "C:\Users\Nino\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\", line 29, in check_response
    raise wde
  File "C:\Users\Nino\AppData\Roaming\Python\Python37\site-packages\appium\webdriver\", 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\", 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?

Full disclosure: I mostly use Ruby for automation.

It’s an interesting question. I took a look at the python client in github and searched for a close() method but couldn’t find one. However, I did find a quit() method. Have you tried using quit()?

I also checked the appium documentation which does say the quit method is the right one for python:

1 Like

Thanks. I’ll try it.