!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Watir vs WebDriver  (Read 3428 times)

Pallavi Sharma

  • Web User
Watir vs WebDriver
« on: March 28, 2012, 06:32:06 PM »
Hi
 
Does anyone here has a comparision of Watir vs WebDriver. I have heard the
 GTAC talks for Selenium vs WebDriver, but is any talks, study available for
 the watir webdriver comparisions..
 
Kindly let me know.
 
Thanks
 
Pallavi.

Simon Stewart

  • Web User
Re: Watir vs WebDriver
« Reply #1 on: March 28, 2012, 06:32:21 PM »
Hi,
 There's a few key differences between Watir and WebDriver. The first
 is that webdriver has always aimed to support multiple browsers out of
 the box, whereas the various attempts to bind to different browsers
 has come later for Watir. Secondly, WebDriver aims to support many
 different languages with the same underlying libraries. Although tools
 such as WatiN and WatiJ exist, they tend to be reimplementations that
 share a Watir's approach rather than sharing code in the same way as
 webdriver does (I believe: someone should correct me if I'm wrong,
 please!)
 
Interestingly, webdriver and watir take similar approaches to browser
 automation for each of the supported browsers: with IE we both
 integrate at the COM level, and with Firefox we rely on extensions
 (indeed, there's a version of Firewatir that's based on webdriver's
 browser communication layer)
 
Does that help?
 
Simon
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #2 on: March 28, 2012, 06:32:32 PM »
Hi Simon
 
Thanks for the quick response. I feel WebDriver becomes a tradeoff between
 Watir and Selenium. Both these automation tools has their own set of
 advantages and drawbacks .. and after going through ur GTAC talks and this
 mail i kinda have this feeling.
 
Regarding browser support i agree, watir is a bit late, although firewatir
 is up and running, but safari and chrome watir are still a bit far...
 
But your second point: WebDriver aims to support many different languages
 with the same underlying libraries
 
I would need some more clarifications here, do you mean , that i can code in
 my own favourite language [Selenium way] without actually changing the
 libs.. how is it possible? and that brings me to this question how does
 Selenium does it, supporting diff languages.? Could you provide some insight
 into it.
 
Yeah watir has other implementations, watij, watin, but they become
 different plugins all together. I cannot reuse my ruby code for watin or
 watij? But can we do the same with WebDriver/Selenium??
 
Will await your reply.
 
Thanks
 
Pallavi.
 
On Wed, Aug 26, 2009 at 3:55 PM, Simon Stewart <simon.m.stew...@gmail.com>wrote:
 

- Show quoted text -

Selenium Webdriver

Re: Watir vs WebDriver
« Reply #2 on: March 28, 2012, 06:32:32 PM »

Simon Stewart

  • Web User
Re: Watir vs WebDriver
« Reply #3 on: March 28, 2012, 06:32:43 PM »
Hi,
 The point with the languages is an interesting one. With WebDriver the
 Java language bindings are really a thin wrapper around underlying
 components. For example, the IE driver is essentially a wrapper for a
 set of C functions that we export from a custom library. The .Net
 binding sits on top of this same library --- the two languages share a
 common underlying component.
 
Similarly, the Firefox driver is mostly implemented in the extension:
 the java and python bindings are just thin wrappers that deal with
 starting up the browser and sending commands backwards and forwards.
 
The nice thing with this approach is that if we discover a bug in one
 implementation, fixing it will cause the bug to be fixed for all
 flavours of webdriver that are based on the same underlying code.
 
In contrast, WatiN, Watij and Watir don't share any code between them:
 they all solve the same problem in different ways (using .Net COM
 Interop, JExplorer and direct COM access respectively)
 
Does that make things a little clearer?
 
Simon
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #4 on: March 28, 2012, 06:32:54 PM »
Yeah it does, and Thanks for this Simon.
 
Another question i have is, Does Webdriver also uses Selenium way to locate
 an element?
 
What i mean is, if the DOM is broken, Selenium RC fails for those web-apps,
 but to Watir it makes no difference.
 
Whats the case with WebDriver?
 
I wrote this blog, after sometime figuring out why my webapp was not
 testable with selenium: http://qacampus.com/blog/?p=75
 
If you get time, do look at it and let me know about WebDriver.
 
Thanks
 
Pallavi.
 
On Wed, Aug 26, 2009 at 6:21 PM, Simon Stewart <simon.m.stew...@gmail.com>wrote:
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #5 on: March 28, 2012, 06:33:06 PM »
Simon
 
Another question I have is...  as far as i have understood... there are two
 ways, tools are working
 
1. Java script: Proxy way [Selenium, SAHI]
 2. COM way [Watir, WebDriver]
 
Am i right here is classifying them?
 
Can you point me to some docs, where i can read more about these approaches,
 how and why they work? Where they become different.  etc etc
 
If you can help, i would be grateful.
 
Thanks
 Pallavi.
 
On Thu, Aug 27, 2009 at 11:46 AM, Pallavi Sharma <write2pall...@gmail.com>wrote:
 

- Show quoted text -

Marc Guillemot

  • Web User
Re: Watir vs WebDriver
« Reply #6 on: March 28, 2012, 06:33:18 PM »
Pallavi Sharma wrote:
 > ...
 > What i mean is, if the DOM is broken, ...
 


just curious: what do you call a broken DOM?
 Cheers,
 Marc.
 --
 Web: http://www.efficient-webtesting.com
 Blog: http://mguillem.wordpress.com

Simon Stewart

  • Web User
Re: Watir vs WebDriver
« Reply #7 on: March 28, 2012, 06:33:31 PM »
Hi,
 By "the Selenium way", I assume that you're asking whether or not we
 use pure JS to locate elements. The answer, as ever, is "it depends".
 On IE, we use the COM automation interfaces as much as possible, but
 (for example when locating with xpath) we also use JS execution where
 it makes sense. On Firefox, we're entirely beholden to Firefox's
 interpretation of the DOM (as is Firewatir)
 
Having read the blog post, there are a few things that don't seem
 right: Selenium can (and does) cope with standard HTML. It's possible
 (though I've not looked) that if a page is served as XHTML or XML and
 doesn't properly close tags that there might be trouble, but that
 would be caused by the browser correctly refusing to handle poorly
 formed XML, as per the spec.
 
Cheers,
 
Simon
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #8 on: March 28, 2012, 06:33:44 PM »
Broken Dom, means unclosed tags, duplicate ids, not following the w3
 standards.
 
On Thu, Aug 27, 2009 at 12:55 PM, Marc Guillemot <mguille...@yahoo.fr>wrote:
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #9 on: March 28, 2012, 06:33:58 PM »
Simon
 
Thanks for the feedback, I spoke to the Selenium users, and they said that
 if the page has unclosed tags then the Selenium will fail with the site.
 anyway and also if the page has duplicate ids or names for web elements, how
 will i use the id identifier?
 
On Thu, Aug 27, 2009 at 2:53 PM, Simon Stewart <simon.m.stew...@gmail.com>wrote:
 

- Show quoted text -

Simon Stewart

  • Web User
Re: Watir vs WebDriver
« Reply #10 on: March 28, 2012, 06:34:12 PM »
Hi,
 There's quite a few ways to automate a browser. Off the top of my head:
 
* Direct control through APIs exposed by the browser (eg: Opera's Dragonfly API)
 * Direct control through APIs accessible from the OS (eg: COM on Windows)
 * "Proxy injection mode": injecting JS through a proxy (as PI mode in
 Selenium, or Sahi)
 * Direct JS execution in a normal sandbox (as Selenium Core does)
 * Direct JS execution in a privileged context (eg: FirefoxDriver,
 Firewatir, Selenium's "*chrome" and "*hta" modes)
 * Image recognition and interacting via VNC (eg: Eggplant)
 * Using accessibility APIs (eg: White)
 
Each and every approach has strengths and weaknesses, and a blended
 approach is also entirely possible. For example, we use bits of
 Firefox's accessibility APIs to allow us to use native events in the
 firefox driver. Hopefully the trade-offs are readily apparent, but
 they boil down to:
 
* Ease of implementation (pure JS in the browser sandbox are easy to
 port, whereas native approaches aren't)
 * Capabilities (compare native execution to JS in a privileged context
 to JS in the browser sandbox)
 * Intrusiveness (pure JS allows tests to run in the background,
 whereas a VNC approach demands the window under test has focus)
 * Interference: does the tool modify the page under test in order to
 work (as Proxy Injection does) or not?
 
I'm sure that there are other factors that matter too. :)
 
Cheers,
 
Simon
 

- Show quoted text -

Simon Stewart

  • Web User
Re: Watir vs WebDriver
« Reply #11 on: March 28, 2012, 06:34:27 PM »
Hi,
 Let's take a quick look at the part of the code that is to do with
 locating elements by ID in the Selenium codebase:
 
http://code.google.com/p/selenium/source/browse/selenium-core/trunk/s...
 
Reading through this, Selenium asks the current document to locate the
 element by ID using the normal "getElementById" call. The behaviour of
 this when there are multiple IDs is technically undefined, but my
 understanding is that all browsers return the first element on the
 page with that ID:
 
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-getElBId
 http://msdn.microsoft.com/en-us/library/ms536437(VS.85).aspx
 
In the case where there is no element returned, we end up falling
 through and returning null. In the more interesting case where an
 element is returned, but the ID is not what we expect an xpath
 expression is evaluated. This step is needed because of how IE works;
 prior to IE 8, "getElementById" did a case-insensitive search of the
 DOM for the first element that had a matching "name" or "id"
 attribute. In IE8 and above, the behaviour falls in-line with the
 other browsers and does a case-sensitive search for a match against
 the "id" attribute alone.
 
So, in answer to your question about how to use the id identifier:
 matches should be assumed to be case-sensitive and the behaviour when
 multiple elements with the same ID are present is undefined. You may
 be lucky and get the first item in the page.
 
The advice I give to teams who want to use multiple identical IDs is
 that they should be using the "name" attribute or a well known CSS
 class name instead.
 
Cheers,
 
Simon
 

- Show quoted text -

Marc Guillemot

  • Web User
Re: Watir vs WebDriver
« Reply #12 on: March 28, 2012, 06:34:42 PM »
this is surely malformed HTML but not a broken DOM. A browser simply
 *can't* have a broken DOM: a document is loaded and it has a DOM or it
 is not loaded and it has no DOM ;-)
 Cheers,
 Marc.
 

- Show quoted text -

Pallavi Sharma

  • Web User
Re: Watir vs WebDriver
« Reply #13 on: March 28, 2012, 06:34:58 PM »
:) Thanks for the correction Marc, i just thought that unclosed tags means
 broken dom, its malformed html i understand that now.
 

- Show quoted text -

WebTestGadfly

  • Web User
Re: Watir vs WebDriver
« Reply #14 on: March 28, 2012, 06:35:14 PM »
You mention Selenium's chrome mode but what about the Chrome browser?
 (I thought I saw a comment about your plans for Chrome in the last
 week but can't seem to find it.  Can you repost?)
 
On Aug 27, 2:35 am, Simon Stewart <simon.m.stew...@gmail.com> wrote:
 

- Show quoted text -

 

Related Topics

  Subject / Started by Replies Last post
3 Replies
771 Views
Last post February 23, 2012, 02:05:58 PM
by Simon Stewart
0 Replies
2519 Views
Last post February 23, 2012, 07:47:51 PM
by Barry
13 Replies
1039 Views
Last post March 28, 2012, 01:27:43 PM
by Ċ½eljko Filipin
2 Replies
622 Views
Last post March 28, 2012, 02:00:39 PM
by Charley Baker
6 Replies
1576 Views
Last post March 28, 2012, 09:19:39 PM
by Jari Bakken
3 Replies
1052 Views
Last post April 10, 2012, 04:04:15 PM
by Andrew Gallo
1 Replies
710 Views
Last post May 17, 2012, 07:54:23 PM
by Alastair Montgomery