How to close driver properly?

Hi,

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:
	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?

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:

https://appium.io/docs/en/commands/session/delete/

1 Like

Thanks. I’ll try it.