Before I always used just Selenium IDE and now should migrate to Selenium2/Selenium WebDriver. What should I install and know to use Selenium2/Selenium WebDriver. Should I know any programming language?
Selenium 2 supports many different programming languages. The language you'll get he most out of selenium is Java, but c# and python drivers are maintained by the community. Personally I use python, and find some gaps from the original java version but have been very succesfuly thus far. If you do not know any programming languages, and/or anything about designing, the project you are working on may not be as successful as you may think and you will be spending most of your time refactoring/maintaining things all the time. You should really know what expectations are set for the project
Maybe this Blog Post helps you:
http://rostislav-matl.blogspot.com/2011/03/moving-to-selenium-2-on-webdriver-part.html
http://rostislav-matl.blogspot.com/2011/03/moving-to-selenium-2-on-webdriver-part_26.html
http://rostislav-matl.blogspot.com/2011/04/moving-to-selenium-2-on-webdriver-part.html
Related
i am learning selenium concepts.while in the process i am not able to decide to go for which programming language.
1- JAVA or 2- PHP
i have worked on PHP and have gud knowledge about it.so please tell me which is the good one php or JAVA and why???
Well the decission is not only yours. In my own example, I have chosen Java programming language.
Not because I have experience with it.
Not because I might have feeling, that "java is better than PHP"
Simply because all developers in my company work in Java. And because I need help with programming, it is almost always better idea to first ask around in the office than to post your question here on StackOverflow :)
I use groovy(he simply of java), and i use Geb freamwork for this.
You can read about this tool there: link
Enjoy!!!
Well decision is your own. In selenium choose programing language in which you have sufficient knowledge and you have a grip on the language.
Both programing language is good and both have its own scope in the market
I am new to Selenium and have spent about a week using IDE. So far, so good. However, some other parts of our application involve heavy drag-n-drop capabilities, and I'm not so sure about that...which brings me to my question...what type of specific things can WebDriver do that the IDE cannot do? I read the Selenium front page, and know that WebDriver can make more "robust" tests, but I'm not entirely clear what robust means in this context? Longer? More capabilities?
What I'm looking for is what type of particular tests could be run with WebDriver that couldn't be run in the IDE? And are any of them related to drag-n-drop? This will inform my decision about whether to keep on using the IDE or to switch over. I think it's better to use something from the beginning than to create a lot of tests and then switch over.
Thanks much in advance.
You can use the full features of your chosen language. For example, using the IDE you are stuck to using the IDE's API, however if you choose to use the WebDriver explicitly you can combine it with C# and use C#'s full features (such as LINQ).
A few of the IDE commands are not directly converted with the WebDriver.
You can integrate a pure WebDriver test into a CI (Continuous Integration) server.
It is not limited to just Firefox, whereas the IDE is (since the IDE is only available in Firefox).
You can improve and extend Selenium more easily. For example using Extension methods and inheritance. (For instance, extending Selenium so that whenever it cannot find an element, it takes a screenshot of the page)
It will be more robust, as the IDE will not always give you the most reliable way of finding an element. For instance, if the element you require is nested within a table, the XPath that the IDE will give you will infer directly to specific table rows and cells.
For instance something like this:
//table[1]/tr[1]/td[2]/table[1]/tr[1]/td[3]/a[1]/b
Is not the most reliable XPath in the world. Those without any knowledge of XPath or automated testing or how Selenium works, will stick with that and then waste hours figuring out why this XPath query fails. Others will change it, and just use the XPath as a base query.
The IDE should usually be used for those who don't have much programming knowledge (e.g some testers), if you want your developers and/or the test developer's to use Selenium, go directly with the WebDriver. It will feel more like programming with a fully-fledged language instead of scripting (after all, the scripts that the IDE generates are purely HTML files). The idea is generally for those who don't have much programming knowledge to simply hit 'play' and let Selenium do the work.
Drag-and-drop are applicable within the IDE and WebDriver.
Most of the development in Selenium (it seems) goes into extending the WebDriver code, the IDE may be left behind in some new features.
Using WebDriver directly, you can also use the full features of a unit testing framework (usually NUnit with C# or Junit/TestNG for Java). This allows things like repeating tests for each browser (i.e repeating tests in Chrome, Firefox and IE) or defining certain logic before and after tests (i.e adding user memberships, creating users, setting up other test data).
Fellow developers might be more inclined to help out if it is using a programming language as opposed to a scripting language (ie WebDriver is programmed in a programming language, the IDE scripts are just HTML files). Putting it in your solution and having it as part of the nightly build process helps to ensure developers help out in your tests progression.
Thinking about it, another example is a bug is fixed but introduces a new bug which causes your test to fail. Who's responsibility is it to fix the test? You or them? Having it use WebDriver directly, they can just look up the source code to Selenium and figure out the API usage themselves. With the IDE, it is literally a HTML file that calls some javascipt. Not much documentation on it.
To sum up: if you don't have much programming experience, either learn a language and use WebDriver with it directly, or just stick with the IDE. Either will do the job.
IDE cannot be used for serious automation. I would sussgest learn the API and use it with Java/C#/Python. It will help you churn out some good automation and will payback really well.
You can always use the IDE to learn how the code is generated.
I will start using JBehave Web to create tests for a web applications, I've been checking and I saw that Selenium now integrates WebDriver api besides the original one from Selenium.
My question is, which one should I use? The application needs to be tested on Firefox and Internet Explorer and has some Ajax functionalities (although nothing too complex)
Also any reference to some good tutorial or book would be greatly appreciated!
The old Selenium (1.0) API is not really being developed any more, it's all about WebDriver now in Selenium 2.0. I recommend it for future-proofing your code.
Use whichever you feel more comfortable with. The WebDriver API has only recently settled down in Selenium 2.0RC3, while the Selenium RC API hasn't been changed at all in at least a year. artbristol is right that the RC API (what he calls 1.0) isn't being developed further, but it's not going away any time soon either.
As to books, there are two very good ones. Both are great beginner’s books for Selenium and a great deal . Both are available in paperback and as e-books. And if you want to peek at them, both authors or their publishers offer partial downloads for free. The e-book prices are very reasonable, and the paperback prices are competitive.
David Burns’ Selenium 1.0 Testing Tools: Beginner’s Guide, free sample at https://www.packtpub.com/sites/default/files/0264OS-Chapter-6-First-Steps-with-Selenium-RC.pdf?utm_source=packtpub&utm_medium=free&utm_campaign=pdf
Alan Richardson’s Selenium Simplified - Automated Web Testing with Java and Selenium RC, free sample at https://docs.google.com/leaf?id=0B2l9DD6OObL9MGQ3NGU4ODYtZmJlYi00MGY1LWIwNDUtZmM2N2UxODU4OWNm&sort=name&layout=list&num=50).
As far as I know, since the two projects (selenium and webdriver) are merged, the underlying infrastructure is the same. So you shouldn't gain speed by using one API instead of another. You should use the API you like most.
My opinion is that the webdriver API is more convenient. It's much more convenient to use objects and not write procedural code. It shortens your xpaths and makes code easier and much more elegant. Plus, it's easier to write page objects when your working constantly with objects.
I am a fresher and being hired as a Quality Analyst in a software firm in automation testing
I have been told to study the Selenium tool.
Can you guys help me in knowing that what are the scripting languages I should get in touch so that I can effectively and efficiently use the tool to give the very best output of mine,
Hoping for responses....It would definitely help me a lot in going in proper direction....
Thanks in ADVANCE
Not exactly scripting languages, but be very fluent with HTML and XML/XPath to easily work with pages and understand how they work.
Knowing a little about JavaScript will also come in handy. As for other languages, Selenium natively speaks HTML, but you can write test cases in any of the following languages (list is not exhaustive):
C#
Java
Perl
PHP
Python
Ruby
Native HTML test case can be translated easily to the aforementioned languages, pick whichever you like the most.
You can get all these details from seleniumhq.org site. Please check the documentation section . Also, regardless of the language you choose selenium features remain the same. So choose the language which you are comfortable with.
Adding to what others have already said, to begin programming with your favorite language using Selenium RC, you need to be familiar with the basic Object Orient Programming concepts.
To help you with XPath there are tools like XPather and Firebug which automatically fetch you the XPath of the element.
The perl language binding is quite reliable and up-to-date.
On the CPAN, the current release Test-WWW-Selenium-1.25 is from 28 Apr 2011. It's actively maintained.
Perl's Test Runners and TAP are cool. There are many other testing modules that you can combine with Test-WWW-Selenium.
Using E-P-I-C perl Editor for the Eclipse IDE, you'd get statement completion in your testcase files.
The Perl API calls are written in a slightly different naming convention: for instance, getEval becomes get_eval
but this is a minor point.
IMHO, the perl code template that Selenium IDE generates for you is ok, it can be adapted. (e.g. I prefer Test::Fatal instead of Test::Exception.)
Cannot say anything about the other language bindings.
Choose the language you are most familiar with, and start building up your expert knowledge of testing tricks, Selenium and browser idiosyncrasies. this will take a lot of time anyway.
For any kind of strong automation, you should know atleast one scripting language like JavaScript, VBScript etc... and one full fledged programming language like Java, C# etc.. benefit of learning java or #C is ... you are comfortable in developing complex solutions because of their OOP nature and Java,C# are widely used in IT Industry.
Robot Framework is a robust scripting engine and reporting tool for automation testing.
I am currently looking at choosing a automated web testing framework for use with a current web project. I am pretty sure that I am going to use selenium. I have been reading a little about selenium 2.0 or webdriver. Does webdriver have a recorder plugin like selenium 1.0 or is it just an API for web tests?
I would appreciate it if anyone could point me in the direction of some good examples of using it.
Thanks
The maintainers of Selenium, sort of answer this question here:
http://www.viddler.com/explore/saucelabs/videos/27/
Look for timestamp 00:56:00 and 00:43:00
Basically, there will probably be IDE support for Selenium 2 eventually. But it isn't there yet and it's not clear what it will look like.
You should probably be avoiding the IDE anyway. The tests that you record using the IDE tend to be fragile, unmaintainable and hard to read. Once you've learned the basics of Selenium, it's probably better to write your tests in a real programming language.
Have you seen - http://seleniumhq.org/docs/03_webdriver.html and
http://seleniumhq.org/docs/04_webdriver_advanced.html
Using Selenium IDE we can format recorded code in different languages - Selenium IDE > Option > Format
But did not see any formatter for webdriver, though bumped on to this -
https://addons.mozilla.org/en-US/firefox/addon/webdriver-backed-formatters/
Only a few minor adjustments are required to get the existing 1.0 C# scripts running under the 2.0 beta of Selenium.
Check out this blog post
Once the RTW release of Selenium is ready, I'm hoping that a better formatter is ready. Until then, I'm able to use my scripts.
You can use Selenium IDE 1.9.x (I am using 1.9.1) or 1.8.x for recording purpose. And then you can export the recording tests into your desired programming language. For example, if you want to convert your recording code (recorded by Selenium IDE) into C# , follow the steps below:
Click File menu at Selenium IDE
Mouse over "Export Test Case As" and then click "C#/NUnit/WebDriver"
Save the file at your desired location
In the same way, you can convert your code to Java, PHP, Ruby etc.
Note: Some code might not be converted exactly in some cases. In that case, it needs to modify code manually