Problem with loading profile of Tor Browser Bundlein Selenium



  • Could you give me any suggestions how to solve the weird problem I experience with WebDriver? I like to use WebDriver to control the browser from the Tor Browser Bundle (TBB). Controlling the TBB via WebDriver works perfectly fine on Linux, as long as you initialize the WebDriver with the default profile. However on Windows the same code makes WebDriver experience problems with loading that profile, despite its path being correct. (It is critical for me to run the application on Windows). Firefox itself displays the following error message: Your Firefox profile cannot be loaded. It may be missing or inaccessible. Yet, the browser loads totally fine with all extensions and running Tor service! However the exception kills the WebDriver script and therefore the WebAutomation sequence is cancelled. Has anybody any suggestions how to overcome this problem? What additional information may you require? Thank You very much in advance! -Bernd My code (python): profile = FirefoxProfile(BROWSER_PROFILE_PATH) firefox_binary = FirefoxBinary(BROWSER_PATH) driver = webdriver.Firefox(profile, firefox_binary) Strangely I get two different error messages running the exact same code. Error 1 - WindowsError: [Error 145]: File "H:\webdriver_project\web_test.py", line 153, in web_test driver = webdriver.Firefox(profile, firefox_binary) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in init self.binary, timeout), File "C:\Python27\lib\site-packages\selenium\webdriver\firefox extension_connection.py", line 45, in init self.profile.add_extension() File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 92, in add_extension self._install_extension(extension) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 285, in _install_extension shutil.rmtree(tmpdir) File "C:\Python27\lib\shutil.py", line 245, in rmtree rmtree(fullname, ignore_errors, onerror) File "C:\Python27\lib\shutil.py", line 245, in rmtree rmtree(fullname, ignore_errors, onerror) File "C:\Python27\lib\shutil.py", line 254, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "C:\Python27\lib\shutil.py", line 252, in rmtree os.rmdir(path) WindowsError: [Error 145] The directory is not empty: 'c:\users\user1\appdata\local\temp\tmpdtgwyq.webdriver.xpi\resource\modules' Error 2 - WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: ' File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in init self.binary, timeout), File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in init self.binary.launch_browser(self.profile) File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 61, in launch_browser self._wait_until_connectable() File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 100, in _wait_until_connectable self._get_firefox_output()) WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: ' (No output)



  • First of all, try the solution suggested here. Also you can try the following [source] First of all, try resetting Firefox - FireFox manual. If this doesn’t help, try to remove your old profile and create a new one manually via Firefox Profile Manager - FireFox manual If this still doesn’t work, try deleting the profile.ini file to force Firefox to create a new default profile: Make sure that Firefox is closed Press Windows key+R to open the Run box Type: %APPDATA%\Mozilla\Firefox Click “OK” Delete the file called profile.ini Run Firefox again



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2