What are the different versions of Selenium, and which one should I get? - selenium

I'm trying to get started with Selenium, but it's extremely confusing for anyone who still doesn't know the project.
If I go to the Selenium download page I get 7 download links for things with different names, and no description of what is each one. And then the Selenium 2 download link points to a page with another 8 files.
What does all of that mean? Which ones are deprecated? Which files should I get?
What are the differences between version 1 and 2? Is the version 1 deprecated, or do we still need to mix some modules from version 1 together with version 2?
And then, after searching on Google, I find Which Selenium Tool Should I Use?, but it's a very outdated page (last edited in 2007). It also talks about a limitation of the JavaScript testing interface: Same Origin Policy. Does this limitation still apply nowadays?
What are "Selenium Core", "Selenium Remote Control", "Selenium IDE"?
How about "Selenium (standalone) Server"? Is it the same thing as the Remote Control, or something different? What is the difference between Selenium Remote Control and Selenium Server?
And then I reach an official FAQ that is also confusing, and talks about a WebDriver thing that was going to be part of Selenium. Is it already inside Selenium? Is that FAQ up-to-date? How does it relate with other Selenium parts?
After all, another way to understand this question is: "I've never used Selenium before, I'm completely lost, and the documentation doesn't help." What I need is an introduction of what are all the parts of the project, which ones are old and deprecated, which ones are needed, which ones are interchangeable, which ones work with different browsers...
(maybe it would be a nice idea to have a community wiki answer that tries to be as accurate and detailed as possible)

I'm not much experienced with Selenium, but recently I have started it to automate form submissions while unit testing. For starters, try Selenium IDE. It is a Firefox addon which will help you to record actions and modify/replay them.
Actually more than that. You can perform Accessor operations, which will perfom a series of recorded/configured actions and will store the end results for us to analyze later.
And then there is Assertions, which will actually check the end state of a series of actions with some pre-configured conditions.
One thing I can say you is that Selenium is very handy and easy to learn. You can write your own test cases using plain html!
Here is a great beginner video - http://wiki.openqa.org/download/attachments/400/Selenium+IDE.swf?version=1
After seeing that, read through this tutorial - http://jroller.com/selenium/
And after that, read this reference - http://release.seleniumhq.org/selenium-core/1.0/reference.html
It explains everything you need to know. If you are first to Selenium, you will be amazZzed to see what all things selenium can do.

Related

Moving on from Selenium IDE

I work in a small firm whose product is a relatively simple web-based software. For the last several years we have used Selenium IDE and it's record-and-play functionality. It has delivered 98% of what we need. However, now that Selenium IDE will no longer be working several months from now, we must find an alternative. We considered using Selenium WebDriver, but none of us no know programming and we just don't have the time to all learn it quickly enough to maintain our current testing. So, we are looking for something that has at minimum the following features...
Has record-and-play functionality (as opposed to programming)
Can support multiple web browsers (Firefox, Chrome, IE, Safari)
Can generate reports
Will continue to be supported for years to come
Has either a large user community or good company customer service
Database connect would be nice
Hopefully, we can import our existing Selenium IDE scripts, rather than rewrite them.
We are willing to pay if it's good.
There are literally dozens of options for software and I don't have a clear path to selecting one. Some promising software is...
- Katalon Recorder and Studio. It looks like an excellent replacement for Selenium IDE. But it has small community for help
- QTP - A colleague previously worked with this and recommends it. It looks like an excellent alternative for webdriver, as it allows record and play. But it is very expensive.
Any help is appreciated.
As per your feature requirement here are a couple of viable Selenium IDE alternatives :
Protractor :
Pros :
1. Simple installation. Only a couple of commands needed to install Selenium WebDriver and start testing.
2. Uses JavaScript which is easy to learn with limited programming background.
Cons :
1. Though flexible but still evolving. Setting up the project and the reporting plugins needs a bit of expertise.
2. Requires clear understanding of sync/async behavior.
Katalon Studio :
Pros :
1. No experience required for installation.
2. Unzip the package and ready to go.
3. No additional plug-ins are required.
4. The scripting interface allows an user to switch between the keyword-base table and the code editor.
Cons :
1.Though web automation and mobile automation is achievable API testing module needs more buildup.
Selenium Builder :
Pros :
1. Selenium Builder contains a lot of code from Selenium IDE and Webdriver.
2. The project is getting forked into a modern and a legacy version.
Cons :
1. As of version 40, Firefox requires all extensions to be signed and as it contains code from Selenium IDE and Webdriver it is getting rejected from signing.
2. Getting Selenium Builder into an acceptable state for signing means removing the existing code, which will remove support for Selenium 1.x and support for local playback of Selenium 2.x.
So it's a mix-bag situation and you can always pick one up and drop the other one at your disposal.
QTP I believe has now become UFT (Unified Functional Test) which does have a record option. Unfortunately what you lack in programming, you'll have to make up for in scripting knowledge (VBScript from what I worked with). It's not impossible but would probably take more effort to learn rather than implementing your own free version of Java/Selenium WebDriver. UFT is extremely expensive especially for a small firm which is a per license fee. If I remember right my last job had multiple licenses each $20k a piece.

Selenium RC architecture and Selenium WebDriver architecture differences

Hi I want differences between architectures of selenium RC and webDriver.
I read lot of functional differences but did not find anything for architecture differences.
If anyone can send/post links of differences that will really appriciate.
Thanks in advance
The difference is quite substantial.
Selenium RC works only using JavaScript for its every command. That means that everything you write is eventually translated into Javascript and run in the browser. This approach has several pros and cons - it should work the same way in every browser, but is limited to "same origin policy" and to JavaScript limitations.
http://seleniumhq.org/docs/05_selenium_rc.html#how-selenium-rc-works
WebDriver actually uses each browser's own and native API's to work with them. That means that it sometimes needs direct help from browser development team, sometimes fails on a new browser version release, sometimes behaves slightly differently on different browsers (but hey, on IE, js was also not the most reliable thing), but is a much stronger tool overall. It should be faster, it should allow for much more complex work without any js limitations.
http://seleniumhq.org/docs/03_webdriver.html#how-does-webdriver-drive-the-browser-compared-to-selenium-rc
Note that while Selenium RC has been oficially deprecated, the WebDriver is now being developed rapidly and it still suffers from several child-illnesses and is not in its full strength. That said, using WebDriver, you can do anything Selenium RC can do. And sometimes more. With an occasional minor bug.
here you can Selenium Webdriver Architecture
http://qeworks.com/selenium-webdriver-architecture/
you can also find diff. between RC and webdriver below
http://qeworks.com/difference-between-selenium-rc-and-selenium-webdriver/
Though there are many advantages of Page Project Model, some of them worth mentioning are :
Simple and clear page classes with sensible method names.
You can actually give the customize names to you methods. Like above so that you need not to keep anything in mind.
Just looking into the method name gives you all idea about the capabilities of the method.
Makes tests more readable. In comparison to above commands of selenium , where in you need to add all the commands in the tests scripts . in page object model you need to put method names. The methods which you have created according to your understanding of application so these methods name are more readable and easy to understand.
Stay [DRY]
Page object model believes in the principle of Do not repeat yourself.
Good support of tests, because everything is stored in one place.
Easy creation of new tests. In fact, tests can be created by a person not knowing the features of automation tools.
As I have actually implemented it in my project so definitely there are some flaws:
All locators should be kept in page class file.
And this abstraction leads to some chaos with in the Page Class file.
So you need to implement something like key word driven on top of Page Object Model so as to fully take the advantages.

Selenium 1 to Selenium 2 Migration

Selenium 2 has been in beta phase for last few months. I would like to know learning’s if any of our us have analyzed/migrated from selenium 1 to selenium 2
How much was the effort involved in terms of Changes# to accomodates 2 features. Methods/API changes#
How much was perf improvements in terms of run time of tests in Selenium 2
Any best practices/learning shared would be useful
Going through the transition myself. If you had Selenium 1 experience, Selenium 2 feels quite different actually. Here is my Selenium 2 pros/cons vs. Selenium 1 I see so far (I use Python so some of them are Python specific):
Pros:
Much faster.
No need to run a separate server.
Gone are wait_for_page_to_load(), wait_for_element_present(), etc. All element interactions, clicks, etc. are blocking now, which is good. The only problem is with asynchronously loaded content (Ajax) though, see Con bellow.
Cons:
Loading/waiting for asynchronous content which used to be "free" with wait_for_page_to_load() requires coding now. These are the solutions I found so far:
use PageFactory/AjaxElementLocatorFactory like explained here, unfortunately I couldn't find the equivalent for Python.
use webdriver.implicitly_wait(N), this seems to be doing the trick with Python but using that seems to cause my script to miss changing elements which it used to detect before.
don't do sleep(T), loop until element appears, etc, that defeats the purpose of the whole thing (and makes wait_for_page_to_load look beautiful)...
The whole thing still feels a bit raw. Different drivers and bindings seem to miss different functionality. Not to say you can't use it but be ready to find 'alternate solutions' for certain problems.
The documentation is a bit dubious (related to the prev. point I guess). Especially for Python. Be ready to read code and experiment a lot (which luckily is easy with Python). Most of the 'tutorials' you'll find on the web (again, esp. Python, Java seems to be much better covered) are just to get you started with the plainest of web applications.
No PHP bindings, not a big one I prefer Python but our original suite was PHP so I noticed.
SeleniumIDE seems to be useless with Selenium 2.
Other differences:
The page elements you are accessing have to be 'visible' on the page at the moment when you ask selenium to find them. For example if you have a menu (containing a list of links) which opens when you hover your mouse over, you have to make sure it is open/visible before you click on a link inside (which wasn't the case in Selenium 1). This has it's uses since you'd be testing what an user would see on the page but requires the extra code. I found two solutions:
run a Javascript which would open your menu, in my case driver.execute_script("document.getElementById('dashboard_menu_navigation').show()") then click the menu item driver.find_element_by_link_text('Orders').click()
use the Mouse / Keyboard classes to simulate actual interaction, this seems to be broken in the Python bindings though (see Cons above):
Example (which throws 'WebElement' object has no attribute 'mouse_move_to' today):
element=driver.find_element_by_id('mn_dashboard')
mouse=Mouse()
mouse.move_to(element)
The Cons list seems longer but that is mostly if you are coming from Selenium 1. I do prefer the lightness and speed of Selenium 2 and despite the early code (using 2.0b4 at the time of writing) the whole thing is quite usable.
Hope to save someone some time...
Moving from Selenium 1 to Selenium 2 is as simple moving from
Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.example.com");
selenium.open("/");
to
Webdriver driver = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, "http://www.example.com");
selenium.open("/");
Since Selenium 2 is more tightly bound to the browser you will see huge difference. I have seen tests running at least 2x faster but in some cases I have seen it running 4x faster.
All the same best practises that you learnt during Selenium will be the translated across
Slides that might help too are posted here:
http://www.slideshare.net/rogerjhu1/lessons-learned-migrating-tests-to-selenium-v2
You can use WebDriverBackedSelenium class to convert WebDriver interface into Selenium interface:
Selenium selenium = new WebDriverBackedSelenium(webDriver, baseUrl);
or you can use the method getUnderlyingWebDriver() to convert Selenium interface into WebDriver interface:
WebDriver webDriver = ((WebDriverBackedSelenium)selenium).getUnderlyingWebDriver();
I posted slides of one of my recent presentation on how to get started with Selenium 2 here:
http://www.slideshare.net/sebarmeli/getting-started-with-selenium-2
One of the best practices in Selenium 2 is the PageObject pattern.
If you are using Java and Maven, you may want to check out this Archetype plugin (that also gives you a first taste of the PageObject pattern):
https://github.com/sebarmeli/Selenium2-Java-QuickStart-Archetype

Choosing an automated testing tool

My project is compatible only with Internet Explorer. I want the test scripts to get generated automatically as it is done in Selenium IDE.
Can i use Selenium RC to test my application? I could not use Selenium IDE as it can be used only with Mozilla Firefox.
seleniumrc works with IE. You can specify the browser and the path to it within the config file.
It can be easily integrated into night builds via ant.
stick to writing the testcase in java.
Selenium RC and Selenium Grid are both really good at running tests against IE. You can see all the browsers that are supported by Selenium here and Selenium is Designed to write for one browser and work in the rest. THere are a few little quirks that wont work in every browser but 99% of the time it will.
Selenium RC works with IE, but is very buggy with IE 6 (to the point of being unusable). Generating the scripts is not trivial and there are many methods of doing it. We have created a Firefox extension that examines objects via introspection to make click recording easy. There are many options out there but your best bet is to write your tests with Firefox/Firebug (or Chrome). They will make object location much simpler and if you are careful the locator strings should still work in IE.
There could be two answer to you question:
Besides Selenium, though it has ample of advantages, I am reading about another tool which uses same API which Selenium use. The only changes in API I have seen so far is it reduces the complexity of functions thus making it more easier and simpler for user who is learning.
The tool is called 'Helium' and it has 50% (and more) less complex functions and code as Selenium has.
The only problem with this tool is it is paid tool for learning purpose and for implementing not-so-big scale project you can use it. But yeah after some time its gonna cost you.
I have implemented some code on Helium. Please let me know , if you face any issue initially or you are thinking to implement it.
Other being, you can use Selenium Builder(http://khyatisehgal.wordpress.com/2014/05/26/selenium-builder-exporting-and-execution/) which is an advanced form of Selenium IDE. It imports your command in different languages and does work more effectively and efficiently as Selenium IDE does(http://khyatisehgal.wordpress.com/2014/05/25/selenium-builder/)
Please let me know , if you have any doubt in any of the tool.
I know Watin is compatible with IE and Firefox. If you want to generate the test code you can use the Watin Test Recorder
This of course is implying that you are using .Net
... Or you could just use the .net bindings that comes along with the latest couple of versions, then you can just run 'em through nUnit.
For ex. Selenium IDE users Katalon Recorder might be a good match. Supports different browsers.

Is there an equivalent of Don Libes's *expect* tool for scripting interaction with web pages?

In the bad old days of interactive console applications, Don Libes created a tool called Expect, which enabled you to write Tcl scripts that interacted with these applications, much as a user would. Expect had two tremendous benefits:
It was possible to script interactions that otherwise would have had to be repeated by hand, tediously. A classic example was dialup Internet access hell (from the days before PPP).
It was possible to write scripts to test one's own interactive applications, programmatically, as part of a regression suite.
Today most interactive applications are on the web, not on the console. Hence my question: is there any tool that provides the ability to interact with web pages and web forms programmatically, much as Expect provides the ability to interact with console applications programmatically?
(The closest thing I am aware of is Chickenfoot.)
You might be looking for Selenium
I've used Selenium RC in conjunction with Python to drive web page interactions programmatically. This has allowed me to write pretty extensive user tests in which forms and inputs are driven and their results are measured.
Check out the Selenium IDE on Firefox (as mentioned above). It allows you to record tests in the browser and play them back, either using the IDE itself, or the Remote Control app.
Perl Mechanize works pretty well for this exact issue.
HTTPS and some authentication issues are tricky at times. I will be posting couple questions about those in the future.
I did a ton of Expect work in a former life and always thought Don Libes' Expect book was one of the best-written and most enlightening technical books I'd ever seen.
Hands down I would say that Perl's WWW::Mechanize library is what you want. I note above that you were having trouble finding documentation. There is good documentation for it! Look up the module's distribution on search.cpan.org and see what all is packaged with it. There's a FAQ, Cookbook with examples, etc. Plus I've always been able to get help on the web. If you can't get it here, try at use.perl.org or perlmonks.org. WWW::Mechanize's author, Andy Lester, is present on Stack Overflow. (He's also an all around friendly and helpful guy.)
I believe WWW::Mechanize also has a program that is analogous to Expect's autoexpect program: you set up a proxy process running this program as a server, point your browser to it as a proxy, perform the actions you want to automate, and then the proxy program gives you a WWW::Mechanize program for you to use as a base for your project. (If it works like autoexpect, you will certainly want to make modifications from there.)
As mentioned above, WWW::Mechanize is a browser (to be more exact, it is a web client or http client) that happens to be programmable. The last time I looked, there was even work in progress to make it support JavaScript.
In addition to Selenium, if you're doing the Ruby/Rails thing, there's Webrat.