Skip to content

Commit

Permalink
Attempt to remove Firefox profile when using Marionette
Browse files Browse the repository at this point in the history
  • Loading branch information
davehunt committed May 18, 2016
1 parent 803c43a commit 5b85c32
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions py/selenium/webdriver/firefox/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def quit(self):
self.service.stop()
else:
self.binary.kill()
try:
shutil.rmtree(self.profile.path)
if self.profile.tempfolder is not None:
shutil.rmtree(self.profile.tempfolder)
except Exception as e:
print(str(e))
try:
shutil.rmtree(self.profile.path)
if self.profile.tempfolder is not None:
shutil.rmtree(self.profile.tempfolder)
except Exception as e:
print(str(e))

@property
def firefox_profile(self):
Expand Down
8 changes: 8 additions & 0 deletions py/test/selenium/webdriver/firefox/mn_profile_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

import os

import pytest
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
Expand Down Expand Up @@ -47,3 +49,9 @@ def profile():

def test_profile_is_used(driver):
assert 'about:' == driver.current_url


def test_profile_is_deleted(driver, profile):
assert os.path.exists(profile.path)
driver.quit()
assert not os.path.exists(profile.path)

0 comments on commit 5b85c32

Please sign in to comment.