6

So, I have the latest Selenium 2.0 Python bindings installed via pip (Python 2.7.2, Windows 7).

I wrote a small script to see if I could get it working:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.com")
driver.close()

This will run, and open the command line. Then, a blank vanilla instance of Firefox 5.0 will launch, with "WebDriver" in the bottom right status bar. The command-line client will then terminate, and the Firefox window will persist. The specified URL does not open, and nor does the browser close afterwards. It just waits there.

I am however, behind a proxy when testing this, so I must admit I haven't tried it outside of the proxy. But, with this in mind, I thought to update my code with new profile information:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", "proxy.xx.xxx.xxx")
profile.set_preference("network.proxy.http_port", 3128)
profile.update_preferences()

driver = webdriver.Firefox(profile)
driver.get("http://www.google.com")
driver.close()

This was based on the issue found here: http://code.google.com/p/selenium/issues/detail?id=2061

Again, the same behaviour as before. Does anyone have some pointers on how I can get this to work?

1
  • Try typing it in to the Python interpreter, see what happens. Try other URLs besides google. Also, do you get the same results with IE? Commented Aug 12, 2011 at 14:05

1 Answer 1

1

I am having the same problem. Tried a similar code outside the proxy and it ran without problems.

I found googling that you need to open Fiddler (http://www.fiddler2.com) before running the coded and then browsers stay and can get to the line driver.get(some url) - I couldn't previously -. But then, when getting an URL, a display is shown for Proxy Authentication and I can not pass through it.

I have being googling and can not find a solution to this problem, but hope the Fiddler ¿solution? can help you in the very beggining.

2
  • I actually solved this, it is definitely a proxy problem- I was using Windows, and I needed to define the proxy in the OS-wide settings, not just the browser.
    – persepolis
    Commented Dec 1, 2011 at 14:56
  • @persopolis If you solved the problem, perhaps you could add an answer describing what you did, and then you could check it as "the best answer".
    – user246
    Commented Mar 30, 2012 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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