Selenium With Python-Firefox always loading blank page
<p>I've got an issue setting up and running Selenium with Python at first. 
My system- Windows 8.1, Python 3.4.4 </p>

<p>When I try to call a browser with python code inside console or even running py doc with this particular code all I get-nothing but a blank page in browser. 
After some time I have errors in console.</p>

<pre><code>    `C:\Python34\selenium\Tests&gt;new1.py
     Traceback (most recent call last):
  File "C:\Python34\selenium\Tests\new1.py", line 2, in &lt;module&gt;
    browser=webdriver.Firefox()
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 80, in __init__
    self.binary, timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.
Profile Dir: C:\Users\Admin\AppData\Local\Temp\tmpxr3qxv83 If you specified a lo
g_file in the FirefoxBinary constructor, check it for details.
`
</code></pre>

<p>It would be really great if you may help me.</p>

<p>P.S. Pip version is the latest-8.1.2 
Firefox version 49.0.1</p>

<p>Here is the code where I've set the environment </p>

<pre><code>C:\Python34\Scripts&gt;pip.exe install selenium
Requirement already satisfied (use --upgrade to upgrade): selenium in c:\python3
4\lib\site-packages
</code></pre>

<p>It have been already installed before</p>

<p>Small update,guys</p>

<p>I have created Firefox profile especially for selenium tests. But I have the same problem with exception again.</p>

<pre><code>&gt;&gt;&gt; from selenium import webdriver
&gt;&gt;&gt; from selenium.webdriver.common.keys import Keys
&gt;&gt;&gt; fp = webdriver.FirefoxProfile('C:/Users/Admin/AppData/Roaming/Mozilla/Firefo
x/Profiles/2byxc9l6.selenium')
&gt;&gt;&gt; browser = webdriver.Firefox(fp)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 80, in __init__
    self.binary, timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.
Profile Dir: C:\Users\Admin\AppData\Local\Temp\tmpe1dfmxt_\webdriver-py-profilec
opy If you specified a log_file in the FirefoxBinary constructor, check it for d
etails.

&gt;&gt;&gt;
</code></pre>

<p>What I did wrong if selenium is searching PATH in another directory?</p>

<p>P.S. Selenium version is 2.53.6. Firefox is 49.0.1</p>

<p>This is a problem with loading a Firefox profile. In order to avoid that, you should use a <strong>custom profile</strong> for your tests. </p>

<p>Create a custom profile: Close all instances of Firefox and then start it from command line with <code>firefox -P</code>. Follow the steps to create a profile with some meaningful name (like 'selenium') and make sure you the directory where the profile is saved. Details are explained <a href="https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles" rel="nofollow">here</a>.</p>

<p>Replace the code in <code>new1.py</code> to create a firefox driver instance with custom profile, e.g. if your profile is located in folder "C:\Users\Admin\AppData\Roaming\Mozilla\Firefox\Profiles\cmx3h2wi.selenium", replace the line <code>browser=webdriver.Firefox()</code> with this (note the forward slashes even on Windows, as explained <a href="http://stackoverflow.com/questions/11095294/using-the-default-firefox-profile-with-selenium-webdriver-in-python">here</a></p>

<pre><code>fp = webdriver.FirefoxProfile('C:/Users/Admin/AppData/Roaming/Mozilla/Firefox/Profiles/cmx3h2wi.selenium')
browser = webdriver.Firefox(fp)
</code></pre>

<p>That way FirefoxDriver should load a profile exclusively for your selenium tests.</p>

python selenium