0

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)
  • I had similar issue and it was because of permission. So try to run the script with sudo command. Hope it helps – user9099 Oct 29 '14 at 18:10
1

First of all, try the solution suggested here.


Also you can try the following [source]

  1. First of all, try resetting Firefox - FireFox manual.

  2. If this doesn’t help, try to remove your old profile and create a new one manually via Firefox Profile Manager - FireFox manual

  3. 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
0

Find profile.ini in tor directory. Copy profile.ini past to desktop. Now delete profile.ini in Tor directory. Also make sure tor browser is set to start up to a blank home page. This worked for Ubuntu Linux. Hopefully it will help windows users. Peace out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.