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
Related
I am automating the GUI using Robot framework with selinium2Library. I am using selenium IDE and I don't find any record and play option for the Robot framework.
Is it possible for record and play back option for the test cases with Robot framework using selenium2Libbrary instead of writing test cases manually?. Appreciate some early response on this one.
Looks like you might got in confusion because of the work selenium which is different when you use it in RobotFramework.
I believe that you have to write the test cases, and you may Pycharm IDE where you get the context help for the in built as well for the user written keywords when the resources are imported.
However, I remember reading in a thread, but could not trace it. Here you can find article on how you can use Selenium IDE to record, but haven't tried myself. You may try it and see how it goes for you.
But I strongly believe that if you write the test, you can organize them into different reusable keywords than depending on the recording the stuff. Good luck.
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 am new to selenium web testing. Could you tell me how to learn it step by step, and what the technologies are that I need to study?
I suggest you download Selenium IDE or Se Builder, which are user interfaces for recording Selenium tests in-browser. Both let you record and then export tests to a bunch of different languages.
One important thing to note is that there's two Seleniums: original Selenium 1, where tests are comprised of a list of steps to execute in order, and Selenium 2 / Webdriver, which is an API for programming tests.
(Full disclosure: I'm the main developer on Se Builder, so I'm totally biased towards it. I do think it's probably less intimidating for a newcomer, but Selenium IDE is as of time of writing the more established and standard IDE. :) )
UPDATED: Additional resources listed below
The record and playback tools Zarkonnen called out are good starts. You also need to understand the fundamentals of Selenium itself. There's good information on writing tests in code on Selenium HQ's documentation pages.
Three things I think important to get correct from the start:
Learn about locators on pages, learn how to store them in one location (read up on the Page Object Pattern and be careful about record/playback tools which may not help you in that approach)
Learn how to deal with dynamic content (AJAX) with implicit and explicit waits
Learn about modular tests. Write small, reusable components.
If you're working in Ruby then I'd really recommend having a look at Cheezy's page_object gem.
Also, have a look at the various intro pages on the Google WebDriver project page.
Update: You should also consider having a look at Dave Haeffner's Elemental Selenium and his Selenium Guidebook. Both are great resources for real-world stuff people struggle with, not facile, shallow examples.
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
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.