What to use instead of Azure Web Apps to allow installation of google chrome in app environment? - asp.net

I've just created a feature for our application which generates a powerpoint report from the data a given user has in our system.
In short, the server spawns an instance of google chrome using Selenium's ChromeDriver, and from there scrapes out the charts from our application running in chrome. It was done this way to ensure the charts in the report look exactly the same as they appear in the clients' browsers.
We use Azure Web Apps to host our development and production environments, and while my reporting feature works fine in local environments, it doesn't work once deployed to any other environments, because it depends on chrome being installed, and I can't get it installed in the Azure Web App sandboxed environment.
(you can see this other question of mine for a bit of a reference to where things are going wrong: PowerShell StartProcess: invalid handle )
SO
What I pretty much want to know is, if an Azure Web App environment isn't going to allow me to install google chrome, where should I look next?
It looks like using Service Fabric may allow me to install what I need appropriately (https://learn.microsoft.com/en-us/azure/app-service/choose-web-site-cloud-service-vm), but it seems like a big change to make just to be able to facilitate this small part of the feature.
Another option is to just re-architect the feature so it doesn't depend on the server spawning an instance of google chrome.. but I'd just prefer to avoid that if there's a straightforward way for me to get what I have working.
Ideally, there'd just be a way to get google chrome installed in the given environment, but I've spent a good 10 hours trying to get that to happen now, and it's not looking promising.

There's a couple of solutions which would work - depending on your code and framework dependencies.
IMO - the simplest way would be to build your code in a docker container (that runs the Selenium ChromeDriver) and deploy it either through the container features on Web Apps or run it on demand through ACI (Azure container instances) and have it create the report and drop it in Azure Storage. In a container you have a lot more options - and you have a great amount of options on how to run it. Spinning up an ACI on-demand to do the job can be done in multiple ways (e.g. from Code or through logic-apps or Powershell/Azure automation).
Here are some links on running containers in your App Service:
https://learn.microsoft.com/en-us/azure/app-service/containers/
https://learn.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image
You could start off by building and adding your code from this image: https://github.com/SeleniumHQ/docker-selenium
Other alternatives of course - you could have a VM that you can install and do what you want with on-demand - however - it'd add more management overhead and other implications to think about.
Many options - but in the regual Web App Sandbox - you're limited.

I have found myself this problem with chromedriver.exe needing a real Chrome. As I cannot install Chrome in Azure App Service I am trying a portable version of Chrome. When using the chrome webdriver I tell it where to find the chrome binary.
var options = new ChromeOptions();
options.AddArguments("headless"); // any options you need
options.BinaryLocation = "YOUR CHROME BINARY PATH HERE";
var driver = new ChromeDriver("YOUR CHROME DRIVER PATH HERE", options);
You should be able to copy the chrome portable files as no installation is required. Although it is heavy, 250 MB, because it includes the non portable version inside.
Be sure to use a Chrome version compatible with your ChromeDriver as pointed in the documentation

Related

How to see what web server is running on my mac?

I'm trying to learn how to create a custom WordPress theme. I've been following a tutorial, and I was trying to install DesktopServer onto my MacBook Pro (to create a local environment.)
But I'm not able to install it because it's stating that
"It appears that you have another web server already running. DesktopServer cannot be installed. Check that you do not have Web Sharing turned on from your System Preference -> Sharing control panel or turn off and remove your other web server."
I've checked my Sharing settings, and nothing is enabled (including internet sharing.) So that must mean I have a web server already running. But I don't know what that would be.
Is there a way for me to find out what web server my mac is running?
And after that, is there a way for me to disable that so I could possibly use DesktopServer instead.
I've really good with writing HTML, CSS, Javascript, etc., but I'm pretty new to the server and hosting and stuff. I honestly don't understand everything yet.
I had the same problem, and the solution that worked for me was here:
https://zachgoll.github.io/blog/2018/serverpress-error/
By default, Mac OSX has an Apache server running in the background
which conflicts with Serverpress by default.
To turn it off, run sudo apachectl stop.

chromium profile directory is already/used by another BrowserContext instance or process

I used an evaluated jxbrowser, which version is 6.14, I write an demo to use it. but i have a problem with it.
Use the demo app to start an application, which can show web UI, keep this applciation with opened, but then I start demo app again, system will throw below exception:
chromium profile directory is already/used by another BrowserContext instance or process
jxbrwowser cannot start two clients in one PC? if can, how to resolve it?
We strongly recommend that you don't use several BrowserContext instances with the same profile directory. Chromium engine wasn't designed for such usage and doesn't support it. Even if you don't see any issues right now, the issues will appear later in end user environments. For example, in macOS environment you will get the Chromium's error message dialog every time when you run your application instance developed in such way.
Since it's a critical requirement in the Chromium engine, I don't think we will make it configurable in next versions. This is how Chromium engine works. These is a recommendation we have to follow when working with the Chromium engine.

Meteor's most basic ("todos") example doesn't work properly on my windows 7 - no reactivity

I've been using meteorjs for quite a while now on linux. But when I installed using the relatively new windows installer, I saw that the most basic example doesn't work on properly on my computer - win7.
The example is at: https://www.meteor.com/try/4
which runs perfectly on my ububtu, but on my windows - I see that no information is inserted into the db and all changes I make (add new "tasks") are only local to that page, and other tabs I opened were also local, and there was no "reactivity" (no information was shared between different pages).
I tried to troubleshoot it in some ways:
I made sure that MONGO_URL is not set, and then I set MONGO_URL to another db, and saw that even though that db reported "connection accepted", the oplog nor the collection updated (tasks) have any new information.
Tried different kinds of browsers (chrome, firefox). Both are latest in version.
See no errors in chrome console.
I am assuming that all writes are made to minimongo, which doesn't pass them on.
Is this somehow a known issue?
Any suggestions?
A few things you can try:
uninstall meteor & any separate instance of mongo (including cmd aliases). download a fresh copy & install. Create a new project in a new folder. If the DB had some weird bugged lock on it, this is sure to fix it.
download robomongo (or use meteor mongo) to insert a new doc & see if it sticks. If it does, you know mongo isn't the problem.
Check that autopublish and insecure are installed. If they are, when you complete step 2 you should see a new doc in the app. If you do, then the DB can communicate to the app, so the problem has to be with the client-side saving to DB. Try a meteor method instead of a direct insert. If you don't see a new doc, then the data from the DB can't reach your client, which means your firewall (yes, it can screw up localhost requests, too) is to blame. Turn it off, make sure ports 3000 & 3001 (mongo) are allowed full access & that it doesn't do anything wonky with websockets.
I would try re-installing Visual Studio 2012 and Python 2.6/2.7, then re-installing Node and then Meteor.

What Mongo GUI tools can I use to connect to my deployed Meteor app?

Tools like MongoLab remote connection and RockMongo require a permanent URL, so the URLs generated by "meteor mongo --url" that are only valid for 1 minute don't work for long.
If you're on a mac I would recommend that fononauts build of MongoHub you put up, the ordinary Mongohub is quite buggy & on Windows use MongoVue which is perhaps the best one i've used of all.

Is it possible to run browsers in headless mode in a windows box?

I'm writing tests using webdriver in Java.
Is there a way to run browsers (ff / ie) in headless mode in a windows box?
I cant use a linux box and HtmlUnitDriver is not helping as our webapp has many ajax controls.
I have started a small project to supply a driver for WebDriver using SimpleBrowser. You may want to check it out: https://github.com/Teun/SimpleBrowser.WebDriver
It's still early days though. I would appreciate help in the form of contributions and testing.
At this point there is no headless version that I am aware of the Firefox or IE. Since Firefox is open source it's possible that you could get the source code for that browser and then remove the UI portion but there are a few problems with it that I can see. First you have to build a custom app to setup your own load testing engine. Second you are locked to one web render, though I think chrome is open source as well but it doesn't play as nicely as Firefox or IE (using the system .dlls vs. a custom executable). Third without a lot of testing I am sure there will be stability issues and potentially other unforseen issues with this option. That being said there is a .net headless browser that's fairly simple and would probably be decent for load testing called simple browser. However it depends on what you are wanting to load. If you just looking for bandwidth and server load then you should be find using multiple instances of the browser. I would be curious to know if using the headless browser in this fashion if you instantiated different WebDriver if it would play nicely. i.e.
WebDriver driver1 = new SimpleBrowser();
WebDriver driver2 = new SimpleBrowser();
.
.
.
.
.
WebDriver driver[n] = new SimpleBrowser();
and then you could run [n] parallel tests. Also of note in the above code SimpleBrowser() doesn't hook directly to the WebDriver interface you would have to Extend the interface to reference that .dll
Start the test program as a Windows service and the browsers will run just fine, even on a machine with no monitors. Technically speaking, they're running in a "session" that is disconnected, but it's essentially what you mean by "headless".
HtmlUnitDriver does support ajax, and can run in both java and c# (if ported via IKVM).
There is, however, no way to run IE and FF in headless mode. I can't tell you how many times I've wished for that...

Resources