Tell Watir to use a specific FireFox app on Mac - ruby

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'

Related

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

How to open browsers in private/incognito mode with selenium?

I'm writing Selenium tests in Ruby to test my website in multiple browsers.
However, the tests won't fire correctly unless the cookies are clear(there are triggers I'm testing that only happen X number of times and is stored in a cookie).
Does anyone know how to have selenium open a browser in its private browsing or incognito mode with Selenium or have another idea on how I might solve the issue?
You can get Chrome to start in incognito by default.
There's a solution for Windows at the bottom of the link below... If you're not using Windows, you can Google how to achieve this for you OS =)
https://productforums.google.com/forum/#!topic/chrome/sYaZkNW8II4

Why does firefox open when I run tests instead of the default browser chromium?

I have chromium set as my default browser. Every time I run rspec and capybara my firefox browser opens. I prefer to use chrome/chromium for development and personal use, so how do I get chromium to start opening when I run tests?
You should use chrome driver for capybara. Please have a look at this answer:
https://stackoverflow.com/a/7512626/582792

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.

Can I emulate previous versions of Firefox within Firefox 4.0?

The Developer Tools in IE 8 (and 9) allow switching Document and Browser Modes to previous versions. Is that possible with Firefox 4?
No it is not possible. It is possible to change the User-Agent string using the Add-on User Agent Switcher, but it does not change the behavior of the Javascript engine.
Having two Firefox versions installed at a time is possible. Just choose a different installation folder. When running Firefox, use different profiles and pass the --no-remote option to prevent a new window being opened with the active Firefox application.
For example, you can create the profile "firefox36" and "firefox4" and run these using:
"%ProgramFiles%\Firefox 4\firefox.exe" --no-remote -P firefox4
"%ProgramFiles%\Firefox 3.6\firefox.exe" --no-remote -P firefox36

Resources