Selenium webdriver opening default firefox profile instead of predefined profile - firefox

How do I get Selenium webdriver to open Firefox with a predefined profile instead of the default profile?
the below code opens firefox with default profile
from selenium import webdriver
driver = webdriver.Firefox()

Related

Firefox started by selenium is not the same as manually started

I have installed some plugins,for examples,Selenium IDE,Thender Extention in Firefox.
But when I use selenium to start Firefox,the Firefox only display Firefox WebDriver in Extensions page.
below is my java code:
ffBinary = new FirefoxBinary(pathToBinary);
firefoxProfile = new FirefoxProfile();
MyLog.logger.info("Initializing the Firefox webdriver...");
driver =new FirefoxDriver(ffBinary,firefoxProfile);
Now I can start firefox in seleinum with Add-ons loaded at start firefox with default profile
Besides,when I open the same web page,firefox started by selenium shows errors in Error Console:
NS_ERROR_FACTORY_NOT_REGISTERED

what is firefox profileing and how can we change firefox profile using selenium webdriver

I have started to learn automation testing and i have come across this concept and its little difficult to understand. I am new to this concept. So..
what is Firefox profiling and how can we change Firefox profile using selenium web driver
Selenium WebDriver launch firefox with a default profile. If you want to launch firefox with your customized settings you can do so by using Firefox Profile.
For Example, if you want to add any extension to firefox you can simply use.
FirefoxProfile fp = new FirefoxProfile();
//fp.addExtension(extensionToInstall);
WebDriver driver = new FirefoxDriver(fp); // here you can launch your webdriver with your customized firefox profile.
Another way to use firefox profile is given here

Tell Watir to use a specific FireFox app on Mac

I am using Ruby Watir. When it opens a browser, it opens FireFox. However, I think it is not the same FireFox I use, because it doesn't have any of the plugins I normally have.
Is it possible to tell Watir to use my FireFox app? (I am using Mac OSX Yosemite).
It's most likely using the same Firefox browser, just that it's creating a new Firefox profile (different profiles do not share extensions in Firefox)
From the documentation:
By default, the Firefox driver creates a new Firefox profile for each test run, which is the recommended action.
You can specify an existing profile to use, such as your ‘default’ profile:
b = Watir::Browser.new :firefox, :profile => 'default'

How to set particular Firefox version in Selenium Webdriver?

I have web app under tests. And I need to test it from Lunix and Windows with firefox 5 only. So, how can I set particular firefox version in New FirefoxDriver() that Firefox 5 runs only, not Firefox 6 or 9?
I don't want to set path to firefox because it's not useful approach when we have several OS.
Create one firefox 5 profile and just give the name of that profile below. It will launch the given profile browser.
FirefoxProfile profile = new ProfilesIni().getProfile(profileName);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, profile);
driver = new FirefoxDriver(dc);
refer this link to know how to create firefox profile.

Selenium with Firefox Offline Mode

I am trying to make selenium (web automation test framework) work with firefox in offline mode.
I found this here, which mentions starting selenium with a firefox profile.
Running Selenium RC tests in firefox in offline mode
This is exactly what I am after, but the part I am missing is how to make a firefox profile start in offline mode?
The reason I am wanting to do this is I am using the new HTML5 functionality to allow my application to run offline.
Alternative can this kind of thing be done with Watin?
Solutions
1
Just create and refer to your profile and block your internet connection
2
Maybe this is also helpful:
https://addons.mozilla.org/en-US/firefox/addon/work-offline/
Or simulate the keypress for Data -> Offline Mode in the Firefox menu
3
Or set the network.online > false
in the firefox profile (about:config)
A bit ugly, but working workaround is to set a non existing proxy in profile. Code:
String surelyNotExistingProxyAddress="192.168.100.100:7777";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(surelyNotExistingProxyAddress)
.setFtpProxy(surelyNotExistingProxyAddress)
.setSslProxy(surelyNotExistingProxyAddress);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver webDriver = new FirefoxDriver(cap);
Then this firefox will load surely nothing from the internet.

Resources