How to start a browser in non private mode by selenium? - selenium

By default, Selenium opens the browser in private mode which
causes the tester has to login again and again. This is stupid
and troublsome. Does it provide any option to avoid this?
My test machine uses Chrome browser.

Related

Dismiss Authentication popup while running selenium tests in Headless mode from Jenkins (with Linux Agents)

How to dismiss authentication popup while running selenium tests in headless mode through Jenkins ? My tests run in Linux docker containers in Jenkins Environment.
The application has SSO enabled hence in most cases, I don't get this popup unless I open the application in incognito mode or run tests through Jenkins (where SSO doesn't work), in which case I just have to dismiss it (same as clicking on cancel button on the popup or pressing ESC key). Also note, entering credentials in the popup won't work (will not launch the application, instead gives error, could be due to oAuth/SSO).
I'm already aware of the following approaches, but none of them really work -
Passing credentials in URL - This approach won't work as it is not basic authentication.
AutoIT - works only in windows OS
Robot class (to press ESC key) won't work in headless mode.
How can I dismiss the authentication popup in headless mode ? I read about Wine tool as AutoIt alternative for Linux OS. Is that the only way to handle this scenario?

Can not access to Zenmate extension webpage only in incognito mode

I try to access Zenmate extension webpage using Selenium and i succeeded opening it in regular mode but i cant access to webpage in incognito mode. I get the error "This page has been blocked by Chrome ERR_BLOCKED_BY_CLIENT". It works perfectly fine in regular window. How can i solve this issue? I need to use it in incognito because dealing with cache and saved data is not good for my Selenium code to run.This is my code to get the webpage.
driver.get('chrome-extension://fdcgdnkidjaadafnichfpabhfomcebme/index.html')

How to get Selenium Webdriver to run on Firefox browser as a different user?

I want to open an application website on Firefox browser using Selenium Webdriver as a different user.
Currently, I am using gecko driver to open that application link, it successfully opens up the browser but unable to open the application link.
But I am able to achieve the same manually by going to Mozilla Firefox icon and clicking on
"Run as different user"
option (as shown in below image) which further open a popup for user credentials and by entering Username and Password of different user there I am able to open the application link in browser.
So, is there any way that I can achieve same process using Selenium Webdriver and opens up my application link.
Thanks in Advance!!
You should rather create Firefox profile by running firefox.exe -p to launch profile manager. Then you can instantiate firefox web driver implementation and configure it to use given profile.
Are you sure that you want to use pre-configured profile? I find much easier to manage to run drivers in private/incognito mode and set cookies manually to configure tests.
You might provide firefox_binary as a parameter for the webdriver:
http://selenium-python.readthedocs.io/api.html
firefox_binary – Instance of FirefoxBinary or full path to the Firefox
binary. If undefined, the system default Firefox installation will be used.
...so, you might use a wrapper script to run firefox as the different user (use sudo in Linux).

How to Force Selenium Webdriver to Use and Keep Cookies?

I'm testing a website which uses cookies for security. Every time a user logs in with a different device or browser they must go through an intensive (email and phone keys) identity verification process. My backup/restore process uses a Firefox addon and works for manual testing.
However when I run Selenium I get triggered to go through the ID process every time. So either Selenium is not using the cookies, or is being given a different browser ID for some reason.
I set a breakpoint to check my cookies are loaded in the Selenium Firefox browser window, but my addon is not available in Selenium Firefox instances.
Selenium documentation is very slim on cookie use:
http://www.seleniumhq.org/docs/03_webdriver.jsp
So any info much appreciated.

Run Selenium tests in one browser while using a second browser window

I am running Selenium automation test in one browser, but at the same time, I want to open the browser in another window and do something like checking mail, googling email then active mode or focus is coming to the current working window, not the automation test run browser.
Is it possible to work on the browser while automation test is run?
In general, when doing UI automation, you cannot use the test machine to do any other tasks that involve using the keyboard or mouse.
Since WebDriver automation performs keyboard and mouse input, such as typing text and clicking items, you will be constantly interfering by taking focus away from the WebDriver instance of the browser and doing your own mouse and keyboard interaction in other applications.
This will adversely affect both you and the automation, with neither being able to do what they want to do!
You should either use a separate test machine, or setup a virtual machine using software such as VirtualBox (free).
Did you try doing that?
Selenium uses WebDriver to communicate with a specific instance of a browser, not the currently focused window. So you should be able do continue to use other instances of browser windows. The best thing to do would be try.
If it isn't working, I would recommend getting a VM up and running and using that as your test environment. Generally that is the way I work to keep everything separate.
I ran my tests on Firefox and then used chrome on the side. Otherwise, run your tests on a remote machine.
You can do 2 things
1. Use a third tool to run test cases like Jenkins. so that test will run in memory.
2. If you are using firefox you can create a seperate firefox profile so that if you use firefox at the same time there should be any issue.
To Create new FF profile use below code:
FirefoxProfile profile = new FirefoxProfile();
profile.setAcceptUntrustedCertificates(false);
profile.setAssumeUntrustedCertificateIssuer(true);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = new FirefoxDriver(dc);