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

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

Related

After using Selenium on macOS, Chrome isn't the same

I installed selenium and used a python program to run chrome using selenium on my MacBook Air. Before there was an error on selenium, and after installing googlechrome drivers for selenium and creating a PATH using terminal, it opened a separate google chrome page that showed Chrome is being controlled by automated test software.
After around 30 minutes of running python and using selenium, I saved and closed out of everything.
In the next 2 minutes, I reopened Google Chrome to search something about web scraping, and the browser was the same one used by selenium. It still showed the Chrome is being controlled by automated test software notice, and there was a Chrome Automation Extension.
I tried:
logging in and syncing, but syncing was not available.
opening Google Chrome from application folder and dock, but nothing changed
deleting Google Chrome and reinstalling, but nothing changed
I don't know how to fix this. Can anyone help me?
Thanks in advance!
Ok, so I found out that the chromedriver was still running in the background. After I closed it using activity monitor, the problem was solved.

Responsive design view on Firefox with Webdriver

Using Selenium Webdriver on Ruby, is there a way to set up Firefox to be opened on "Responsive Design View" and continue executing tests for the whole session?
I've done it on Google Chrome and it's working fine (sans the touch support part). For Firefox, I've only seen questions around creating preset for screen size but not much activity on how to actually execute tests on said profile.
Please advise.

How do I Start My Browser (Firefox) the Way Selenium Does?

I've got a Selenium test which crashes my browser (Firefox) whenever it runs. It's just a simple test (login, logout, login, logout, login ... crash) and I can't reproduce the crash when I do the same things manually, so I think the problem is with Selenium itself.
However, the issue could be that my Firefox starts with different options than when Selenium starts it. I could confirm that's not the case if I could start Firefox the exact same way Selenium starts it (eg. without plug-ins, with all history cleared, etc.) ... but I'm not sure how to do that.
Can anyone tell me which options to use to make Firefox run the same way as when Selenium runs it?
I was never able to find out how to emulate Selenium's use of Firefox. I tried using a fresh Firefox profile, but that still seemed to have differences from how Selenium ran Firefox.
Instead I wound up re-writing my test to be two tests, and then it was able to log in/out twice in the first test and once in the second test, avoiding the issue I was trying to debug (which only manifests when I try to log in/out 3 times in the same test).
If anyone can provide a better explanation of how to emulate Selenium's running of Firefox I'd be happy to accept that answer.

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

not able to run in chrome

iam not able to run selenium rc with chrome.it runs fine in
firefox.Any one sucessful in running in chrome browser?
These links will help:
Sauce Labs: Available browsers
Google Groups: Selenium Users > Browser Strings
These are Browser Strings are available:
*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
*googlechrome
This is Google Chrome and not to be confused with *chrome which is
actually Firefox.
*chrome
This one is a little confusing. The 'chrome' of a web browser is the
usable space for the web page. That is, if the display is 1024x768,
the chrome will be smaller. The title, menu, toolbars, status bar,
etc. will reduce the usable space, i.e. the chrome. Google Chrome was
called Chrome because one of the main goals was to maximize the
chrome. Selenium was using the keyword *chrome before Google Chrome
and it was using it for Firefox.
Are you using *googlechrome as the browser string? If so, you need to be using 2.0a6. Chrome is utterly broken in 1.0.3 and 2.0a7.

Resources