what are the advantages of selenium webdriver over selenium RC - selenium-rc

Can anyone help me in understanding the difference between Selenium RC and WebDriver and which one is better and why?

Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to support Ajax and other heavily dynamic pages. However, this also means Selenium runs inside the JavaScript sandbox. This means you need to run the Selenium-RC server to get around the same-origin policy, which can sometimes cause issues with browser setup.
WebDriver on the other hand uses native automation from each language. While this means it takes longer to support new browsers/languages, it does offer a much closer ‘feel’ to the browser. If you’re happy with WebDriver, stick with it, it’s the future. There are limitations and bugs right now, but if they’re not stopping you, go for it.
Selenium Benefits over WebDriver
Supports many browsers and many languages, WebDriver needs native implementations for each new languagte/browser combo.
Very mature and complete API
Currently (Sept 2010) supports JavaScript alerts and confirms better
Benefits of WebDriver Compared to Selenium
Native automation faster and a little less prone to error and browser configuration
Does not Requires Selenium-RC Server to be running
Access to headlessHTMLUnit can allow really fast tests
Great API

It's explained here.
Selenium-RC uses JavaScript to automate web pages. Therefore it is constrained by what you can do with JavaScript, specifically, it is constrained to the JavaScript sandbox. It also requires the Selenium-RC server. It supports many browsers and many languages.
WebDriver uses native automation and does not have the sandbox constraints of Selenium-RC. It's a little faster and does not require a server.

Related

Been asked to use Selenium to test Windows desktop application UI--how is this possible?

A company I applied to had sent me a "test", which I had to decline, due to it not making a lot of sense: They asked me to use Selenium to test a Win desktop app GUI and produce bug reports in the table form. They claimed that they're using Selenium to test Win desktop applications in their company, but they wouldn't tell how.
I did some research, and my understanding is that Selenium works with web browsers only, as it's been specifically designed for this. How can it connect to Windows desktop app? I just don't see any way possible for this. I found a claim that some integrate it with another open source tool to do this, but this "test" was supposed to take 1 hour of my time and installing some other framework, configuring, integrating with Selenium, etc, etc definitely wouldn't fall into one hour time frame. I had heard from another company too, that they wanted me to use Selenium to automate non-browser stuff if they hired me... Still have no clue about this--is this even possible? -- or is it something simply wrong?
You can't. Selenium can only automate web browsers, and even then, only certain browsers (Chrome, Firefox, Internet Explorer, Opera, and occasionally Safari). It interacts with them at a very deep level, very specific to the browser in question, in ways that don't apply to other Windows applications.
Selenium is meant for GUI tests of web applications and nothing else. But you can include Sikuli in webdriver code and can test the any of the applications either desktop or web applications, since it uses Image recognition.
else if you want to test the desktop application using Selenium thne u need to import Autoit and can test those as well

Performance comparison of HtmlUnit vs HttpUnit

I would like to write crawler which supports cookies storing operation and sessions. There are two different implementations of java headless browser. HtmlUnit has better support of javascript and perhaps html parsing. But is there are any reason to use HttpUnit for performance of crawler?
There is a relevant article here, from one of the HtmlUnit developers.
It basically says that, apart from Javascript support, HtmlUnit is more high level that HttpUnit. HtmlUnit also seems to be more actively developed (2 releases in 2014 while HttpUnit has not been updated since 2008).

Web technologies in GUI apps

What's your experience in using web technologies (HTML, XML, CSS, JavaScript) to implement part of the functionality of a GUI application? Pros and cons, please.
No servers, relational databases, AJAX, or cookies for session management, nor an existing webapp either, but rather a GUI app that uses web widgets (like Qt WebKit) to render and handle substantial parts of the UI, while taking advantage of a GUI framework to achieve an even richer interaction and better desktop integration.
I've already validated that the approach is possible using PyQt. Content can be rendered from the file system or from strings, and URL requests (images or clicks) can be captured and served by the form's event handlers. CSS and JavaScript are supported, perhaps with some limitations.
# ...
self.webView.page().setLinkDelegationPolicy(
QtWebKit.QWebPage.DelegateExternalLinks
)
#...
class TotiMainWindow(QtGui.QMainWindow):
def linkClicked(self, url):
pass # events arrive here
Note: This question is different from this one and this one made before, among other things because there is no requirement to use web technologies on the GUI, but there is the requirement that the application should work without a network connection available, and should integrate well with the default desktop over different platforms, without previous infrastructure requirements (no .NET, Java, browsers, or database servers).
Note: I posted a different version of this question on PMS but found very little experience with this approach there.
Closing Note
I just found most of the information I was looking for in a series of blog posts by André Pareis.
I think the largest advantage to using web markup like HTML/CSS and other web technologies is that desktop apps may very well have their days numbered.
As we speak, Google engineers are working on the Chromium OS, which essentially consists of a single GUI application... the browser...
Now, while nothing may never actually come of it, there is clearly a rising trend in the number of applications accessible through a web browser, accessible anywhere. It seems to me that this is the future of application development.
By using these technologies, this becomes one less headache you have to deal with when or if you determine that your app should be available as a web application.
Update: A few years ago, we developed an Agent Desktop for our call center that is essentially a local application that opens sockets to integrate with the phone system. The user interface the agents use is built with HTML, CSS, and JavaScript, and the experience is stunning. When we released our latest update in 2010 with a professional CSS redesign, our agents were all very impressed with not only how easy it was to interact but also how easy it was to use.
In the future we will port this 100% to the browser, but for now it needs to be a local application because of the COM integration with the phone system.
We did exactly this for a project back when Windows XP was new.
This gave my team several benefits:
A good-looking UI with relatively little effort
Easily change the style of the UI in a consistent manner using CSS
Relatively simple integration with C++ (invoking functions from the ui and vice versa)
The drawbacks we saw were:
Some not-so-good firewalls considered accessing internal resources (ie other html pages in the ui) to be a web request
Adding and accessing the needed resources could in some cases be a bit cumbersome
It was possible set properties in Internet Explorer that would prevent JS from running in the application
Note that some of Windows XP:s programs are using this approach.
This probably works best with small, more Wizard-like parts of the ui (which our ui consisted almost entirely of).
I have since then not really been involved in ui projects, so I cannot really tell you whether this approach is still valid... I know that MFC-based applications will let you use HTML-based dialogs though.
In a similar situation in 2005 I created a stand-alone webapp using XForms, CSS, JavaScript, XML and XML Schema for offline data retrieval and verification. With a good XForms -> HTML + JS transformer (Chiba) it did the job with no bug fixes after the initial release. It was used for 6-12 months (IIRC) by about a dozen engineers for a project gathering test data in the tunnel of the Large Hadron Collider. The biggest surprise of that project was just how much you get for free when going for a web platform, even for offline use. Highly recommended.
The major problem is that it reduces your development speed, or the quality of your user interface. A lot. Unless you're using Seaside, it is much faster to develop a desktop app.
There is quite some number of applications built on top of Mozilla platform. It isn't 100% web technology, as instead of HTML you use XML based XUL, but the rest is indeed web stack (JavaScript, CSS). The most successful of these it the OpenKomodo and it's commercial big brother Komodo IDE.
On the other hand, as far as Qt goes, the newest version 4.7 you can build GUI using QML language. Don't let the name mislead you, it's not markup, it acctually JavaScript with app-specific extensions.

Is there a way to test Comet applications without a running browser?

I'm trying to connect to an application that uses Comet and is pretty heavy on Javascript and Comet. I've gone as far as I can go in Firebug, HTTP Header examination and am trying to see what's coming over the wire by writing something using Ruby Mechanize.
However, since I have no client run-time, my approach is to mimic the HTTP requests going back and forth (doing this using Ruby Mechanize). I'm looking at the logs and comparing them to LiveHTTPHeader output and it's very similar but the server isn't responding (I don't have access to the server side code).
Are there tools that could help? Has anyone tried simulating the DOM and Javascript runtime using something like Rhino or is that just asking for pain?
The only sane way I've found to run automated tests on web apps involving substantial Javascript (w/ or w/o Comet) is selenium rc -- basically, mechanizing/automating a real browser from your favorite programming language. (There may be other approaches with a similar architecture, but Selenium is popular and it's what I'm familiar with). Simulating browser's DOM and JS is just too painful -- been there, tried that, failed miserably;-).
Visual Studio 2010 Ultimate edition provides very good testing support for web applications. I had tried the web load test and it was impressing.

How can I check my AJAX for browser capable?

I always have to check each and every browser to see if my website would work. Is there a website where I can check it with?
Update:
I don't really want just screenshots (which what browsershots do), I want to actually test the posting of my script.
You want a web site to check your web site for javascript compatibility? How would you expect it to know how to exercise your interface to trigger the proper interactions? Or are you thinking of it doing some sort of static code analysis? I think you are better off coding against a framework that has solved most of the browser-dependent idiosyncrasies and using it to check for browser capabilities before you use them. jQuery, MooTools, Prototype/Scriptaculous, etc. go a long way in solving these problems for javascript.
Note that you still need to worry about rendering your site, but you already have several answers for how to go about doing that based on web sites. Personally, I just maintain IE/Safari/FF/Opera/Chrome on my workstation and do significant checking in IE/FF and basic checking in Safari/Opera/Chrome.
Even when there exist websites that allow you to see a static snapshot of your site in several browsers, you should really test your page on them yourself, because there can be subtle, and not so subtle, bugs and differences that are only apparent when interacting with the webpage.
You can cover yourself quite a lot by testing in
A Gecko engine browser (Firefox)
A Webkit engine browser (Chrome, Safari, Konqueror)
Opera
AND IE6+
John Resig recommends checking the Yahoo graded browser support documentation.
If you write unit tests for your javascript, you could use testswarm http://testswarm.com
There are multiple options:
http://ipinfo.info/netrenderer/
These site will let you run multiple browsers and version without installing. You only need to install a plugin
http://spoon.net/browsers/
There are plenty of sites, just Google/Bing for browser compatibility check.
http://browsershots.org/ is a good one.
Although most of them just take a snapshot of the site, you might have to do the manual check for things like menus and dynamic content.
BrowserShots might do what you want if you can tell by rendering a particular URL whether or not things will work as expected.
In light of your update, you could still use BrowserShots by creating a page which tests each of your scripts and renders 'pass' or 'fail' as its content depending on whether they work or not.
Failing that, Multiple IE is quite useful for running various versions of IE on one PC which can otherwise be problematic.

Resources