"Bundle" selenium application with browser? - windows

Basically I'm going to distribute my Selenium program to a number of clients for automation purposes.
Rather than asking every customer to have FireFox installed (and risking possibly incompatible versions) I would prefer if I could have FireFox (or whatever browser) packaged in my program directory (perhaps a portable version).
All my customers will be using Windows btw.
Anyone tried this or have any suggestions to how this could be accomplished?
EDIT: I suppose I could use PhantomJS with selenium and just package my software with the phantomjs driver. That would not require any external browsers to work, would it?

You have also HTMLUnit headless browser option. Please note that it has own proprietary JavaScript rendering engine so need ensure that your test also will work with the "regular" browsers.

Another option is to use Selenoid and Docker for Windows. Your customers could download easily removable images with browsers (no need to clutter Windows with browser files) and run your test suite in multiple containers in parallel.

Related

Robot framework - Selenium Lib - Getting embedded browser from Outlook

My solution is using a special way to open a web page: we embedded chrome browser into outlook app.
Now I have to write automation test for it using robotframework.
I tried but selenium cannot detect that browser.
Any ideas are appreciated.
Thanks!
Because Selenium uses the Webdriver to start the browser, automating a browser that is not started using webdriver won't be supported.
Alternatives are to use AutoIT library, that automates your keyboard and mouse actions and focuses on windows. ImageHorizon Library and Sikuli Library use image pattern recognition and support both Windows and Linux.
If your target OS is Windows 10, then Microsoft WinAppDriver maybe of interest. This follows a similar approach as AutoIT, but from Microsoft. Does require the Python Appium application to be installed as well.
All approaches have the pro's and con's and in my view beyond the scope of this question.

Executable HTML/Javascript Applications on the Desktop?

I'm wondering if there is a way to create a Desktop Application that is essentially a Browser, except that it only runs my Application, doesn't need installation and is a static executable that contains the HTML/Images/CSS/JavaScript packaged into it, with an option to access arbitary embedded resources through JavaScript?
I believe Mozilla/Firefox allows this through their XUL Framework, which is actually used for Applications (see Celtx). However, the last time I looked into it (~3 years ago), it was a horrible experience and overly complicated.
Has this changed? Or is there a WebKit based option?
You should try Chromeless.
.. doesn't need installation and is a static executable that contains the HTML/Images/CSS/JavaScript packaged into it, with an option to access arbitary embedded resources through JavaScript?
Chrome supports .crx files which is essentially a zip file with the resources archived into it. It doesn't technically require installation since it's run on the Chrome browser itself.
I know it's not directly relevant to your question but I think building web apps with HTML5, CSS3 and JavaScript is the way to go. You can even package it and have it install like an app and distribute it via an app store even.
I went with XULRunner in the end. The latest version is much improved over the one I looked at several years ago.
You could use NW.JS:
https://github.com/nwjs/nw.js
NW.js is an app runtime based on Chromium and node.js. You can write
native apps in HTML and JavaScript with NW.js. It also lets you call
Node.js modules directly from the DOM and enables a new way of writing
native applications with all Web technologies.
Basically you create a folder with your entire html app. On Windows, just add 4 files (or more depending on your needs): package.json, nw.exe, nw.pak, and icudtl.dat. When you run nw.exe, your app will launch in a packaged version of chrome with node.js support. You can access the file system using node commands directly from your original html.
The drawbacks: NW adds ~60MB to your application and additional memory overhead.

Are there any good scriptable webpage rendering engines besides Selenium RC?

I like using Selenium RC for automating interaction with webpages that require JavaScript, except for the fact that it goes through launching an full instance of Firefox to run a script. Questions:
Is there a way to run Selenium RC so that it launches a headless version of Firefox that doesn't create a window? I'm using OS X. I know there is a way to do this using Xvfb on a Linux server, but I'm wondering how this would be done on OS X.
Is there any lighter weight alternative to Selenium RC? The tool would have to execute any JavaScript on a webpage and alter the DOM accordingly. I'm not too familiar with Spidermonkey; but can it be used for this purpose? Thanks.
There's a well supported Java one called HtmlUnit, which is completely headless - there is no GUI. It runs Javascript.
If you don't want to directly call Java, you can in theory run Selenium with HtmlUnit as its backend headlessly - I haven't got it to work yet though.
Also, you might find Selenium 2 better than Selenium RC. It has the WebDriver built in, and looks like it is going to be better and more complete.
Finally, you could run Selenium remotely on your own separate Linux server, and call it from the Mac remotely. Or you can use a service like Sauce Labs.

Firefox minimal build

I want to compile a portable version of Firefox 3 on a low cost Intel Celeron Windows Xp machine to run as a kiosk computer. So i just want the browsing functionality since i'll be running it on the fullscreen mode. What are the steps to do a minimal rebuild from the sources?
Also what is firefox's command line parameters to open a site from the cmd?
A "Stripped down minimal build" doesn't really make any sense. You can't really exclude any functionality that would make it run faster or be any smaller, since most of the code that Firefox needs to render webpages is the same code that it uses to render its user interface. Forget about trying to "strip down" the code.
That being said, it sounds like you probably want to use XULRunner, which will let you use all the web browsing functionality of Firefox, but wrap it in your own GUI. You can find an ultra-minimalist browser XUL application here:
http://benjamin.smedbergs.us/xulrunner/mybrowser-0.2.2.xulapp
There is a Kiosk mode addon (more for a lock-down) for Firefox.
You may be in general interested in this other question here:
How to lock down Windows XP for use as an internet kiosk?
Here is a gHacks reference for custom builds.
and, a Prism reference.
http://webconverger.com/ provides a minimalistic OS build featuring Firefox. There is also build instructions if you want to build your own customised images.

How can I decide my browser (*firefox,*ie) from command line in the rake file?

I have a rake file which runs few tasks. I want to run my tests on several browsers without hard-coding it on each test. Any suggestions would be great.
Have you considered using Watir? It provides an abstract interface to browsers for testing including interfaces to Internet Explorer (by default), Firefox (firewatir), Chrome (ChromeWatir) and Safari (SafariWatir) - IE only on Windows (obviously) and Safari only on OS X (I'm not sure, I don't think they've made it work with Safari for Windows).
You basically make either a method or a class which takes the browser and the URI you want to load and loads them using the relevant Watir classes. Then you create Rake tasks which call the relevant method. The advantage of this is you aren't having to work out where Firefox is, and call it differently if it's running or not.
I haven't done any Watir stuff for a while - I'm moved to Celerity/Culerity for browser testing - but even if you aren't using it for testing, you should be able to use it for launching browsers from Ruby across at least Windows and Mac, and possibly Linux too.
I guess the best way would be to traverse the filesystem based on your current OS and finding the executables of the browsers you want.
Maybe you can take the Launchy code and make it do what you want? :)
http://copiousfreetime.rubyforge.org/launchy/
Launchy is helper class for launching cross-platform applications in a fire and forget
manner.
Currently only launching a browser is supported.
Launchy.open("http://www.ruby-lang.org/")
On OS X, this works for me:
`open #{url}`

Resources