Skip to content
This repository has been archived by the owner on May 22, 2018. It is now read-only.

Commit

Permalink
handle potential URLError from sending shutdown, set self.process to …
Browse files Browse the repository at this point in the history
…None after it's already been quit

Fixes SeleniumHQ#1504
  • Loading branch information
lukeis committed Jan 22, 2016
1 parent 9afb684 commit d57afc1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion py/selenium/webdriver/common/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ def is_connectable(self):
def send_remote_shutdown_command(self):
try:
from urllib import request as url_request
URLError = url_request.URLError
except ImportError:
import urllib2 as url_request
import urllib2
URLError = urllib2.URLError

url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
try:
url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
except URLError:
return
count = 0
while self.is_connectable():
if count == 30:
Expand Down Expand Up @@ -134,6 +140,7 @@ def stop(self):
self.process.terminate()
self.process.kill()
self.process.wait()
self.process = None
except OSError:
# kill may not be available under windows environment
pass
Expand Down

0 comments on commit d57afc1

Please sign in to comment.