4

So, I want to automate actions on my website (including some Javascript execution and XPath element findings, performing click/type events) but the thing is that I don't want the endpoint users to install any third party software.

Been looking through many solutions and found out that selenium would be a great solution for my needs, however:

It does require endpoint user to have Google Chrome / Firefox browser installed in case of using chrome/firefox driver that support headless browsing.

So I kept searching and found CefSharp which would embed the browser into my application. That however, it's really a boilerplate solution without the ability to find elements by XPath and compared to selenium is less functional.

My question is: Are there any other solutions (for C#) for having a functional headless browser, without requiring the endpoint user to have the browser installed so that I could deliver my binary as a ready to use?

RA.
  • 969
  • 13
  • 36
  • Possible duplicate of [Headless browser for C# (.NET)?](https://stackoverflow.com/questions/10161413/headless-browser-for-c-sharp-net) – mjwills May 16 '18 at 22:47
  • @mjwills Given solutions are headless but not browser-independent meaning that I'm still required to deliver the browser myself. – RA. May 16 '18 at 22:52
  • Which browser is Optimus dependent on? – mjwills May 16 '18 at 22:53
  • @mjwills None. It has only a `Jint` dependency (JS execution engine). However, there is lack of info about `Optimus` around, it looks like it's not being updated anymore and have no documentation whatsoever. – RA. May 16 '18 at 23:02
  • Is PhantomJS an option? – mjwills May 16 '18 at 23:06
  • 1
    @mjwills Sure, I think it would be great to use along with Selenium, however the development of PhantomJS has been [discontinued](https://groups.google.com/forum/m/#!topic/phantomjs/9aI5d-LDuNE). – RA. May 16 '18 at 23:16
  • @DonaldDuck You could use a **portable version of chrome** instead of the local installation, and package it with your application to use selenium with. – PixelEinstein May 17 '18 at 00:42
  • @PixelEinstein Interesting. Might be unsafe though since I don't think there is an official source of portable version of chrome? – RA. May 17 '18 at 00:56
  • For reference you can use Selenium with CefSharp – amaitland May 17 '18 at 09:41
  • @amaitland That would basically be the same choice as using Selenium with Chromium (Chromium supports `--headless` switch as well) – RA. May 17 '18 at 09:42
  • I am aware of this, I'm simply telling you what's possible. – amaitland May 17 '18 at 11:27
  • @amaitland Any idea if I could use CefSharp with conditional `--headless` flag? I mean, for debug, I would like it to run normally but in release I'd like to pass the `--headless` switch to it. – RA. May 17 '18 at 21:03
  • You can use the OffScreen version and still open devtools or add your own command line arg and show a WPF window, it uses the same rendering engine as the OffScreen version. – amaitland May 18 '18 at 09:14
  • @amaitland You mean the OffScreen version would be able to output in the WPF window too? – RA. May 18 '18 at 09:55

0 Answers0