Basic Authentication with Firefox in Selenium and Nightwatch.js - selenium

I use Nightwatch-Cucumber based on Nightwatch.js. Nightwatch.js is a NodeJS framework based on Selenium.
Currently I'm looking for a smart and simple solution to handle with Basic Authentication, especially with the Firefox. In Chrome I can do the Basic Auth via URL, like:
https://user:password#mydomain.com
But in Firefox, I get an anti-phishing dialogue box. I tried it manually on about:config in Firefox with the new entry:
network.http.phishy-userpass-length=255
But without success.
At How to Perform Basic Authentication for FirefoxDriver, ChromeDriver & IEdriver in Selenium WebDriver?, a lot of different solutions were named. But no solution is a smart one.
Maybe is it possible to send a Basic Auth header via Selenium? Or is there any other solution to realize such a Basic Auth, especially in Firefox. A generic solution for every browser/driver will be the smartest solution.

Related

Login through Google SSO using automated browser

I am trying to automate login to my app which uses among others, google sso authentication.
However login form return error "This browser or app may not be secure.". I set my google account options to allow less secure apps but still nothing.
I browsed few topics:
GMail is blocking login via Automation (Selenium)
Selenium Google Login Block
Automation Google login with python and selenium shows ""This browser or app may be not secure""
And it seems that google is blocking this way at all in favor of oauth.
People write in these topics that solutions stopped working recently
So is it currently possible, to set ChromeDriver somehow using capabalities, to be able to login through SSO?. I need a simple solution, that will run headless with other scripts on cloud (not something that would require me to manually login first on another instance as one anwser suggests).
If its not possible or extremly complicated please tell me I will not waste time on it.
If you want to use chrome capabilities, what you can do is set the user-data-dir to a chrome profile that has already been signed in using SSO.
You should look up how to reuse chrome profiles with selenium.
If your accounts have 2 steps verifications, google believe it's safer and allows you to get login. Then the issue will be how to handle the 2 steps verifications. Working on that :/

Safari 13 basic authorization in webdriver

I am looking for a way to fill basic authorization popup in Safari 13 in automated session. I want to log in to website which require such login. Solution can be even manual. Is there any way to do that?
List of solution which I tried:
Fill form manually. Issue: Safari 13 blocks any interaction with automated browser. As far as I know there is no way to do it and then continue with automated session.
Use selenium to fill the form. Issue: Safari does not support such feature.
Use http://login:password#site.com. Issue: Safari 13 does not support such feature.
Add authorization header using proxy. Issue: Some sites does not work the same with proxy. I tried browsermob-proxy and mitmproxy but site did not works the same as without proxy.
Add authorization header using proxy and then refresh page without proxy. Issue: Header is not saved in browser. Authorization is required after refresh.
Use ApplyScript or other to fill the form. Issue: Safari 13 blocks any interaction with automated browser.
Safari extension with authorization header. Issue: as far as I know safari extension does not support any headers modification.
Use Keychain access. Issue: It can not be used in automated session.
Based on a few GitHub issues, I'm not sure if this is possible to achieve given all of the workarounds you have already tried.
This issue is detailing the Safari basic auth issue, closed as out-of-scope for Selenium:
https://github.com/SeleniumHQ/selenium/issues/5610
Which a Selenium developer then links to a still-open, larger-scope issue, in the WebDriver spec repository:
https://github.com/w3c/webdriver/issues/385
It seems like the basic auth support you are looking to achieve needs to be implemented by W3C contributors, not by Selenium developers.
All of the solutions you have mentioned trying seem to be the only available workarounds out there, and without a supported Selenium solution or fully-functioning workaround, this issue may not be solvable.

robot framework test user role single sign-on

I'm trying to use robot framework as a ui test tooling for a website we use internal.
To test different user roles I open the browser with basic authentication (http://user:ww#url). Unfortunately this methode is removed from chrome and chromedriver (http://www.chromestatus.com/feature/5669008342777856) (for the test I use PhantomJS).
because of this issue subresource requests are blocked. See image attached.
Because of this issue also js files are blocked and therefore my UI tests don't work properly.
Does anybody have an idee on how to solve this or another way of testing?
This issue is being encountered by all browser automation frameworks. This SO answer describes an approach to take a two step approach:
Go to the url with http://user:pass#hostname.ext
Go to the url with http://hostname.ext
The username and password are cached and subsequent visits will reuse it.

Selenium Basic Authentication Tomcat - Solution for Chrome, IE, Firefox

Hi I am using Selenium WebDriver with Java. So I have a website A from which after I fill form I go to website B but before it asks a Basic Authentication Username and Password.
I read in SO that, Basic Authentication Support Is not provided in Selenium.
I read somewhere I can use ROBOT Class(not sure what do u mean by that in Java) but it is risky to use.
I am not sure how to handle this event as after I reach to B I have to do some more validations before Passing the test case.
I hope someone can help.
Thanks.
I think you should be able to overcome it by using the following URL
http://username:password#www.example.com/
Don't forget to give a / at the end. I think you can refer this

How to use Selenium with Digest Authentication?

I am looking for a good way to use Selenium with Digest Authentication (for a flex UI though I don't think that makes a difference if I can't do authentication). I'd like to avoid platform-dependencies such as using AutoIT to drive browser pop-ups (since cross-platform testing is a motivator for going to Selenium), though if there's a good cross-platform library for doing such things that would work fine.
I'm thinking maybe there is a way to use a separate http client to create a session and then pass the session credentials off to the browser, but I'm not sure how to inject the session ID into the browser requests. That's just an idea I had, not sure how feasible it is.
You could try using an HTTP proxy, such as AuthProxy by #CarlYoungblood.
It's an HTTP proxy server written in Ruby which was developed specifically for testing a server that required basic authentication with Selenium, but it should also work on a server with digest authentication.
Simply explained, you cannot automate a Flex UI from Selenium, as it doesn't handle Flash for testing (you can embed the flash plugin in your browser, but Selenium won't be able to test against flash component...)
Even if you can authenticate, you won't be able to test anything, so, you should try something else, like Sikuli