Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I heard one can load a custom Firefox profile when starting webdriver, but I've yet to find a way to do that. The Python binding documentation doesn't state it very clearly.

I need to start up Firefox without JS because the site I'm testing has a lot of ads injected by Google and some are very slow to load, making the tests slow as well because it waits for all the page objects to finish loading.

share|improve this question
    
Have you tried to disable Google ads in FF? I am not very certain if this is a solution but worth a simple shot. – Zain Khan Dec 23 '11 at 7:46
    
    
@mangobug, I'm not sure how to disable Google ads in FF. Even if I do, that still requires loading a custom profile for selenium, no? – samxli Dec 23 '11 at 8:04
    
@pyfunc: that's just information on how to set a new profile, but I want to know how to load a custom profile when selenium webdriver starts running Firefox – samxli Dec 23 '11 at 8:07
    
Help for blocking ads is @ lancelhoff.com/blocking-google-adsense-ads and the answer to the latter part is yes you would have to. – Zain Khan Dec 23 '11 at 8:15

You can use the -firefoxProfileTemplate command line option when starting the Selenium server. But it seems rather counterproductive to disable javascript when testing how browsers behave on your site (unless your site doesn't have any scripts of its own) - you should rather use adblock, or disable the IP used by Google ads in the hosts file of the Selenium server, or set a custom useragent for Selenium tests and don't load ads based on that.

share|improve this answer
    
I'm using Webdriver with the python bindings. Does this work with that? – samxli Dec 23 '11 at 8:14
    
I haven't used Webdriver, but it should; this is an option for the Selenium server, it has nothing to do with you choice of client. – Tgr Dec 23 '11 at 8:22
    
Not working for me. This is how I ran my script: python somescript.py -firefoxProfileTemplate "someprofile". After hitting "enter" it says "option -i not recognized". BTW, I'm running this via command line on Mac with python 2.7.2 – samxli Dec 23 '11 at 8:51
    
This is an option for the Selenium server (which is ran with something like java selenium-server.jar). You probably use WebDriver without a Selenium server. The Selenium docs have instructions for selecting a profile in that case; I haven't used Webdriver myself, so I can't say if that works. – Tgr Dec 23 '11 at 11:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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