Selenium chrome windows authentication - google-chrome

I am automating a webapplication which uses windows authentication to sign-in.
I am using selenium specflow c# and running my tests on teamcity which uses grid in turn on the build agent.
However each of my row in Examples under scenario outline is testing with a different user.
We are using before scenario hook to create the Remote webdriver instance which is context injected to all the step bindings. However, at this point it is assuming that the user is the logged in user on the hub .
If I am using hub/grid, I am able to test with only one user login as the website takes the user credentials of the logged in user on the hub.
To work around this, we have used credentials embedded in the url. This happens in the Given step much after the hooks run.
While Chrome stopped the support for url credentials, how do I impersonate the users logging into the browser connected via remoteweb driver.
I have explored using process to create webdriver process and passing the credentials. I am not sure if this is the right way.
Or how do I make Chrome prompt for user credentials and stop auto logging as the hub user.
Because of this we are unable to upgrade the Chrome version.
I have explored so much but did not find a conclusive solution.
Regards,
Vijaya

Related

Remote Debugging Azure App Service with API Management?

Is there a setting necessary to be enabled for APIM to forward remote debugging calls to its associated app service? When I portqry, the port is reported as Filtered, not Listening.
There is a workaround to the problem. First, download the latest publishing profile for the app service and open it. With the project loaded, select Debug > Attach to Process. Use the destinationAppUrl in the profile for the Connection target. Append the url with ":4024" and tap "Enter". That will start the connecting to the cloud debugger for the app service. A login dialog should appear. Use the
first userName and userPWD values to fill the dialog. When entering the userName, prefix it with a backslash so your local domain is not applied. Select the Attach button.
From my experience to date, multiple attempts may be necessary. When that fails, try disabling Debugging in the app service and re-enabling with saves in between. Also restarting the app service might assist.

What is the difference between a Native Application & Server Application when talking about ADFS Application Groups?

I'm new to Federation Services and I'm trying to understand how ADFS works as a whole and I've started to get down into the details. I followed along with creating an app using OIDC to authenticate a user, however, within the tutorial, they specified using a "Server Application" when setting up an Application Group. This ended up not working for me so I tried setting up a "Native Application" application group for kicks and was able to successfully login.
The thing that threw me off is, I ended up hosting ADFS on a server outside of the domain in which I had my application running, so I'm confused as to how that is "native" in terms of ADFS.
I went looking for this answer within microsoft's documentation but I didn't find the information very clear.
Native Application:
"Sometimes called a public client, this is intended to be a client app that runs on a pc or device and with which the user interacts."
Server Application:
"A web application that runs on a server and is generally accessible to users via a browser. Because it is capable of maintaining its own client 'secret' or credential, it is sometimes called a confidential client."
This may seem simple to some, but I'm trying to really get a grip on what would be used when. To me it sounds like a native application is used when you're running the application natively on a pc in which the user is also using the same pc, and the server application is run remotely in which the user would not be using the same machine. Is it really that simple or am I misunderstanding?
A native application (in Microsoft speak) is something that is not browser based e.g. mobile. The code runs client side. It may use JavaScript in which case the secret key is publicly accessible. (The secret key is one of the OAuth parameters). You use ADAL / MSAL to access it.
A server application runs server side e.g a web API. The secret key is not publicly accessible. You use OWIN to access it.
These terms have no relevance to where ADFS is actually installed. Native applications typically are not domain joined.

clear http authentication cache from Chrome

I am sure this is not a new issue I am facing, but couldn't find any resolution yet.So, we have a ng2 app which uses Windows Authentication. It is implemented using Waffle libraries with Jersey RESTful service. We are implementing logout functionality, which seems to have an issue where browser is caching credentials, until all of it’s instances are closed.
When user launches browser for the first time (first instance of browser), it prompts for credentials as expected. When user clicks on “Logout” option from application, session is invalidated on server. But, next time when user refreshes URL or launches application in new tab, browser do not prompt for credentials.
In Internet Explorer, using document.execCommand(“ClearAuthenticationCache”) clears credentials stored for the user. Is there any equivalent code or way to clear http authentication cache from Chrome?

localhost refused to connect, after returning from paypal sandbox

Testing with PayPal checkout with Selenium & chrome webdriver.
I have tried using another domain name, localhost and 127.0.0.1
It may be important to note i am running inside a Vagrant machine (homestead)
Also tests run manually work.
I believe the issue to be an environment variable
PAYMENT_SANDBOX_PAYPAL_URL=http://localhost:8000/checkout/, however that is confusing as from what i understand there should be no difference when running automated tests with a webdriver.
Is this a networking issue with vagrant and my host? how would i diagnose this?
I understand this is a pretty specific question to the mentioned setup, however i think other new selenium users like myself will find it useful, especially when using codeception and laravel.
Perhaps it has something to do with whitelisting ip's?
Here is the current command.
java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalonjar -Dwebdriver.chrome.bin="/usr/bin/google-chrome" -Dwebdriver.chrome.driver="vendor/bin/chromedriver" -Dwebdriver.chrome.options="--whitelisted-ips=173.0.82.77,127.0.0.1"
I would guess chrome is running with different profile when launched manually (when it is able to load) and when launched through webdriver. WebDriver launches the browser in a different profile which may be very different than default profile which may include some settings related to proxy/networking.
From https://sites.google.com/a/chromium.org/chromedriver/capabilities
By default, ChromeDriver will create a new temporary profile for each session. At times you may want to set special preferences or just use a custom profile altogether. If the former, you can use the 'chrome.prefs' capability (described later below) to specify preferences that will be applied after Chrome starts. If the latter, you can use the user-data-dir Chrome command-line switch to tell Chrome which profile to use:
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
You can create your own custom profile by just running Chrome (on the command-line or through ChromeDriver) with the user-data-dir switch set to some new directory. If the path doesn't exist, Chrome will create a new profile in the specified location. You can then modify the profile settings as desired, and ChromeDriver can use the profile in the future. Open chrome://version in the browser to see what profile Chrome is using.
Are you sure, that PayPal Sandbox URL should be a local URL, not accessible from outside of your box?
Please provide more details! What web framework/web server do you use? What are libraries you used to get PayPal working.
I think, if the behavior differ when running Selenium, it is an issue completely related to WebDriver settings, or it's work together with Vagrant.

Can you enable chrome.storage and chrome.fileSystem for normal localhost testing?

I'm developing a Chrome App and it's irritating using the suggested workflow of manually refreshing the app every time I make a change. I'd like to use a normal localhost server workflow but I need access to chrome.storage and chrome.fileSystem. Is there a way to enable these features outside of the extensions sandbox?
Is there a way to enable these features outside of the extensions sandbox?
No.
Not directly, anyway.
You could conceivably make a proxy extension/app that will execute privileged commands for you using "externally_connectable" messages.
But that will not help you in development - you'll need to proxy all API calls in a complicated way. It would probably also fail for APIs that require user gestures.
You should instead look into programmatically reloading your app by some external command. This is possible - an extension using management API and a native "proxy" module using WebSockets or Native Messaging can allow you to refresh your app by any event in the system.
It's the approach taken by GhostText, for instance.