BrowserStack Selenium local authentication dialog - c#

We're trying to use BrowserStack in local mode to hit our AUT on our internal network. I've got it configured so that I'm getting the remote browser session, but as soon as I try to direct it to our app's (or any) URL within the firewall via Chrome, the browser throws up a dialog complaining that the connection is not private and asking for a user name and password. This is not a normal pop-up and we can't automate it with Selenium, so it stops us dead.
When accessed via a desktop browser session the system knows who I am and opens for me with all appropriate permissions etc. It doesn't know who... or what... is coming through the remote session, thus the requirement to authenticate, I guess?
We see slightly different behavior with Edge: No pop-up, it just clocks until time-out. OTOH, if I just try to launch Edge in BrowserStack Live, I get a message saying "If you're behind a corporate firewall, disable SSL inspection for *.browserstack.com", and then I get thrown out.
I've been scouring everything I can find about local to see if there's some way I can create the remote session with an 'identity' (I'm talking network identity, not B'stack user name/access key) and all I'm finding are things that pertain to proxy servers. As far as I know, there is not a proxy server at play here, so I'm really kinda up in the air.
Are there folks with experience with B'stack local mode who might be able to provide some insight?
rabbit

If you don't have the local binary downloaded and running on your machine...it could cause this to happen.
You can download it here:
https://www.browserstack.com/local-testing/automate#command-line
After you have it unzipped on your local machine...open up terminal:
./BrowserStackLocal --key yourkeyhere
Once it is running on your local machine, try to open up BrowserStackLive and run your manual tests.
Are you also having issues with automated tests not completing or just the manual testing of the website?

Related

HTTP 503 error when behind ZScaler corporate proxy and trying to access web app

A couple of days ago our web app started showing a 503 error when trying to access our web app. It works fine when ZScaler is off. This is an old app running .NET MVC 5 on a Windows Server 2012 machine. No changes were made from our side when the issue started happening, so I was suspecting that the networking team had done something. However, they cannot seem to locate the issue.
When trying to access the page through Chrome, I get a HTTP 503 error, but on Firefox it shows a blank page and says that the connection is not secure. I can access the web app through the server hostname URL fine. However, when trying to use the registered domain name, it is displaying this error. I have checked the logs on the server, but it isn't showing anything specific to this error.
Does anyone know what this could be? Is there anything in IIS that I should look at specifically?
I have checked the logs on the server, but it isn't showing anything specific to this error.
An HTTP 503 error usually indicates that the server is currently not able to handle the request due to maintenance or capacity issues. It could be caused due to many factors, like a server outage, an issue with the network, or a problem with the application itself.
Here are a few things you can try to troubleshoot the issue:
Check the IIS logs, IIS logs are located in the
C:\inetpub\logs\LogFiles folder by default.
Check the event logs, event logs can be accessed through the
Event Viewer (eventvwr.msc).
Try accessing the web app using the server's IP address instead of
the registered domain name. This can help determine if the issue is
related to the domain name or the server itself.
Make sure that the application pool for the web app is running and
that the application pool identity has the necessary permissions to
access the web app's files and resources.
Check the network configuration and make sure that the server is
properly connected to the network and that there are no issues with
the network connection.
Check the web.config to make sure that it is properly
set up and that there are no issues with the web.config file.
Check the ZScaler configuration to make sure that it is not
blocking access to the web app. You may need to work with the
networking team to determine if there are any issues with the
ZScaler configuration.

System.Diagnostics.Process.Start("Notepad.exe"); is not working on live server

I'm unable to execute the following from a asp.net web application.
System.Diagnostics.Process.Start("Notepad.exe");
The project builds without errors and it works fine locally. On the live server, it just times out. I spent hours researching this online, only to find that there are others that have had the same problem. So far nothing has worked for me. Most replies seem to suggest looking at permissions. Our IT Director isn't sure how to resolve this issue either.
You probably run the web app on IIS Express locally. That means anything like opening Notepad can work, as it runs under your account in your session.
However, running on full IIS is completely a different thing, as revealed in my blog post,
https://blog.lextudio.com/2015/04/web-application-differences-in-visual-studio-and-iis/
Even if Notepad is opened in that way, it is in session 0 on IIS server side, and you cannot see it.
If you attempt to open Notepad in JavaScript at client side, you might also be forbidden to do so, as browsers run client side web apps in sandboxes, which removes access to the operating system resources.
Usually only web apps that explore the security holes in web browsers can launch Notepad by bypassing sandboxing as well as other security protection mechanism, and you probably won't be allowed to do so in a normal web app.

How do I impersonate a local user that resides on a remote server

I have a problem, and have scoured the web for a solution without luck. I therefor hope of a genius reads this and have useful answer to my problem.
I have a domain (“MyDomain”) and a server (“StandAloneServer”) outside “MyDomain”, but on the same physical network. On “StandAloneServer” there is a local user (“LocUsr”) that is used to run a service, and has rights to start and stop that service.
From a computer that resides inside “MyDomain”, I can access the “StandAloneServer” via RDP by using the IP address for the “StandAloneServer” and the credentials for “LocUsr”.
So far, so good - Now my problem occurs.
I would like to make a small program, that can be run on a computer that resides inside “MyDomain”, that can start and stop the service on “StandAloneServer” using the credentials of “LocUsr”. In this way a person with limited credentials and knowlagde of RDP and services can start and stop the service when needed.
All impersonation examples I can find builds on that the user to be impersonated is a member of “Mydomain” or that the program runs on the same computer as the local user – neither of this is true in my case.
How do I impersonate a local user that resides on a remote server, so that I can start and stop a service on the same remote server?
Try using psexec. This tool worked great for an application I was recently involved with for remotely restarting applications by impersonating the local user on a given pc.
Also WMI was a tool used in the project.
Here is an article on remote commands
Just remember that these tools are quite finicky and are unforgiving about syntax.
If you need a bit more, I would be happy to expand my answer

Run .exe on client system from server-side c# code

I want to run an exe on client system from my c# asp.net website. When I use Process.Start()
it throws an error:
The requested operation requires elevation.
How do I set permissions to run that exe?
You can't spawn processes on the client machine from server-side code.
When you use Process.Start in server-side code, it is attempting to execute the process there, on the server where the website is hosted. If you wanted to create processes on the clients computer then you would need to expose a download for them (and not in employing subterfuge, like malign sites might do to install software - supply it gracefully, and normally (and with permission)), or a Silverlight application or something along those lines.
The bottom line is that the code you want to execute (even if that is just to spawn a process) must reside on the client, and be executed there.
You can't run an application from a web server like that. You will have to have the user download the application by supplying the EXE, a setup file or using ClickOnce.
Or you can develop an ActiveX control that you can have the browser automatically download from a Trusted Internet Zone.
Once downloaded, proper signing with a certificate (signed from the trusted (corporate) root certificate) will avoid the user getting a prompt to ask whether he wishes to allow the ActiveX control to install/be activated -
The ActiveX control can subsequently do anything the interactively logged on user could. This means that to actually install a program you'd need to elevate (UAC on Vista+); But if the goal was just to run a standalone executable, you should be good to go.
This all assumes white-hat purposes in a (larger) corporate setting, because it relies on PKI infrastructure and central browser policies, to name just two.**
This would, really, lead to some excellent questions on serverfault or superuser
I noticed you said you wanted to run an exe file on the client, but you didn't say explicitly that the exe is on the server and you want to push it to the client. Everyone seems to be assuming that is the case.
You CAN accomplish this fairly easily with a small JavaScript if you have a few prerequisites:
The executable is already present on the client machine.
All of your clients are running IE
You can enforce a policy to put your site in the Intranet or Trusted
Sites zone.
So basically this means it's a corporate intranet application. I am assuming this is probably the case since, well, if you were expecting to do this with a public app, I would be surprised.
For the script to accomplish this, please see my answer to this question:
How can I get a program on a client machine to run from an ASP.NET page?

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I've moved from XP over to 7, this seems to have stopped working.
I'm running the selenium RC server process as administrator, since that was necessary to get an IE instance to launch properly.
I've tried adding permanent security exceptions for the certificate in question, and have confirmed that this works when I myself launch a browser session. But when a browser session is instantiated by the Selenium RC, I'm still receiving the security warnings.
I've also tried specifying the 32bit version of IE, in case it was just the 64bit version that wasn't working, but both exhibit the same behaviour.
I've also tried temporarily disabled UAC, in case I was falling foul of a permissions/elevation problem, but that also did not help.
Has anybody managed to get the heightened privilege browsers working properly on Windows 7? Alternatively, does anybody know a way that I can get around this issue? (short of not using https!)
Thanks!
Have you tried adding the certificate to your list of accepted certificates by hand?
As IE doesn't have profiles, and each session uses the user's profile, you can add the certificate by hand the first time the error occurs to Selenium and next time the browser finds an error to warn, it will find the cert in the list of exceptions and proceed with the page without warning.
For Firefox, the best way to get around this is to create a custom profile with all the certificates accepted, then specify that profile when you start your Selenium server. I use this same strategy for setting up browsers in different languages.
*chrome is normally the way to run Firefox with relaxed security.

Categories