I'm using selenium-webdriver with ruby and rspec2.
I have a lot of web test automation for which I need to use IE and I need to run each test with a clean session (specifically cookies cleared).
In this case selenium-webdriver is using InternetExplorerDriver (IEDriverServer.exe) for which the documentation indicates:
There are 2 solutions for problem with cookies (and another session items) shared between multiple instances of InternetExplorer.
The first is to start your InternetExplorer in private mode. After that InternetExplorer will be started with clean session data and will not save changed session data at quiting. To do so you need to pass 2 specific capabilities to driver: ie.forceCreateProcessApi with true value and ie.browserCommandLineSwitches with -private value. Be note that it will work only for InternetExplorer 8 and newer, and Windows Registry
HKLM_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Mainpath should contain key TabProcGrowth with 0 value.The second is to clean session during InternetExplorer starting. For this you need to pass specific ie.ensureCleanSession capability with true value to driver. This clears the cache for all running instances of InternetExplorer, including those started manually.
My question is simply this: Can anybody give an example of how this would be done in Ruby / Rspec2.
For example, I currently have:
before(:each) do
@driver = Selenium::WebDriver.for :internet_explorer
@driver.manage.window.maximize
@base_url = "https://www.example.com/"
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = 30
@verification_errors = []
end
How can I pass such IE parameters to the IE driver using Ruby / Rspec?
Thanks very much for your help.