Is Selenium can do it? - selenium

I have no experience with testing web page in SeleniumHD and I would start soon.
I have a website http://ffmama.azurewebsites.net/Home/About
On it is a chart which time the tests need to enter data.
This is time-consuming and tiring job.
I thought to SeleniunHD - but is it able to do?
- Enter data into multiple table cells, eg from an external file or a spreadsheet,
- To wait for a response from the server
- Save the result of the work file
Please answer the questions
Thank you and best regards

Yes, you are right. I need Selenium WD.
Do you have any experience? how to start, make first step to fill cells automatically?
The primary new feature in Selenium 2.0 is the integration of the
WebDriver API. WebDriver is designed to provide a simpler, more
concise programming interface in addition to addressing some
limitations in the Selenium-RC API. Selenium-WebDriver was developed
to better support dynamic web pages where elements of a page may
change without the page itself being reloaded. WebDriver’s goal is to
supply a well-designed object-oriented API that provides improved
support for modern advanced web-app testing problems.

Related

Selenium Webdriver vs Mechanize

I am interested in automating repetitive data entry in some forms for a website I frequent. So far the tools I've looked up that would provide support for this in a headless fashion could be Selenium WebDriver and Mechanize.
My question is, is there a fundamental technical difference in using once versus the other? Selenium is mostly used for testing. I've also noticed some folks use it for doing exactly what I'm looking for, and that's automating data entry. Testing becomes a second benefit in that case.
Is there reasons to not use Selenium for what I want to do over Mechanize? Does it not matter and both of these tools will work?
I'm not asking which is better, I'm asking which is the right tool for the job. Perhaps I'm not understanding the premise behind the purpose of each tool.
These are completely different tools that somewhat "cross" in the web-scraping, web automation, automated data extraction scope.
mechanize is a mature and widely-used tool for programmatic web-browsing with a lot of built-in features, like cookie handing, browser history, form submissions. The key thing to understand here is that mechanize.Browser is not a real browser, it cannot execute and understand javascript, it cannot send asynchronous requests often needed to form a web page.
This is where selenium comes into play - it is a browser automation tool which is also widely used in web-scraping. selenium usually becomes a "fall-back" tool - when someone cannot web-scrape a site with mechanize or RoboBrowser or MechanicalSoup (note - another alternatives) because of, for instance, it's javascript "heaviness", the choice is usually selenium. With selenium you can also go headless, automating PhantomJS browser, or having a virtual display. As a commonly mentioned drawback, performance is often mentioned - with selenium you are working with a target site as a real user in a web browser, which is loading additional files needed to form a page, making XHR requests, rendering etc.
And this itself does not mean you should use selenium everywhere - choose the tool wisely, choose it because it fits the problem better, not because you are more familiar with an instrument.
Also note that you should, first, consider using an API (if provided by the target website) instead of going down to web-scraping. And, if it comes to it, be a good web-scraping citizen:
How to be a good citizen when crawling web sites?
Web scraping etiquette

Selenium Learning step by step

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.

A simple text based full web-page regression testing

My duty is to pick up and continue developing PHP website for a small sized business client. Project has no testing code. I want to quickly establish at least very basic regression testing for the backend of the site.
I need to test the full contents of the web page char to char. Must see the diff of failed tests.
I need to be able to set up cookies and GET/POST data.
Once every few days I am updating the local database from production database. I would like to then have an overview of failed tests and very quickly update my test suits so that everything is passing again.
Is using WatiN or Selenium a good idea? My local environment is Linux.
About Selenium (and only Selenium as I don't know WatiN) - it can only do what you can do in your broswer. It can click, type in fields, submit forms, take screenshots (that's a very good one), set up cookies (so yes to this one). You can always set up GET data through the URL. But I am not aware of any technique in Selenium that would allow you to set up POST data in any other way than navigating in a browser. Also, because the tests are in your browser, they are not particularly fast. E.g, on our product, a single thorough test with ~250 steps takes about 10 minutes on my computer to complete. Of course, you can always divide that between many computers using Selenium Grid. It's just more work.
To conclude it - I'd say yes, Selenium is good for your needs as there are so many ways to write a good test in it that everyone finds his style. It is good for quick checks, functionality affirmations, but also for full-scale tests etc. But if you want to do some really advanced stuff, then that's a job for a long time. Selenium offers so much functionality in so many different ways that it is definitely a full-time job to understand them and know how to use them.
Try Selenium-IDE for 20 minutes. It is just an addon for Firefox that can record your actions and then replay them. If you like what you see, go for it. If no, hire someone who will.
I'm not sure if I am too late here, but in regards to WatiN it is only IE based, so if you plan to use any other browser you are better off with Selenium WebDriver (though WatiN has some Firefox support). From what I have found (I have used both WatiN and Selenium) Selenium can achieve more low level interactions (also see Selenium Grid), but really I think it is dependant on what you are looking to achieve and personal preference. If you have time to write your own wrapper to interact with WatiN/Selenium you will find the tests themselves are rather quick to run. Also, the beauty of Automation is that once these tests are written you can run them and walk away while they complete.

Selenium or WebDriver api?

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.

How to stress test a javascript-requiring Web App

A similar question was already asked (
Performing a Stress Test on Web Application?), but I'd like to test a web application that prevents double-submits and takes some counter-XSRF actions and therefore REQUIRES JavaScripts to be evaluated.
Has anybody done stress tests with web apps that require (and use) JS and any experience to share?
jMeter wouldn't work I guess...
Thanks!
Watir?
Watir is a simple open-source library for automating web browsers.
Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected text appears on the page.
It drives Internet Explorer, but is also functional with Firefox (and Safari to some extent).
The problem with Watir and Selenium RC or any other full browser solution is that they need a full browser :P
Browsers are very expensive to run, often requiring 300MB or more of RAM. Multiply those requirements by even 100 and you need massive hardware. Fortunately, there is a solution: I recently started a company that does exactly what you're looking for.
Check out http://browsermob.com and you can run a limited test (up to 25 users) to get a feel for the app. Feel free to contact us if you have any questions at all!
One solution that may be worth pursuing is to run Selenium on Amazon EC2 to provide the scalability you need. There is a tutorial over at Selenium using a sample that ships with Selenium grid. Windows machines are 12.5 cents an hour for a small machine meaning that a 500 machine test is going to cost $62.50 an hour.
PROS:
Selenium runs in a real browser meaning that your Javascript is executing as it would on a client
Low cost - trying to do this on your own hardware would cost significantly more
CONS:
You would have to establish network connectivity from Amazon to your application
The testers I work with use Bad Boy for load testing. I'm fairly certain you can test interactions that use javascript, so you should be able to test stuff like double-submits.
As far as your backend is concerned, it doesn't matter what triggers a request whether it's from JavaScript or a load testing tool as long as the request is valid.
You can create a bunch of fake requests that do lots of different things (hopefully representative of actual usage patterns) and slam your webserver with a load testing tool.
There's a bunch out there:
jMeter
http_load
Grinder
httpperf
Because JMeter is not a browser, it won't interpret the JavaScript code on the page you GETting:
JMeter does not process Javascript or applets embedded in HTML pages.
[JMeter Wiki]
So, what can you do? You can add WebDriver to JMeter test and by this, evaluate the web pages.
Web Driver Sampler automates the execution and collection of
Performance metrics on the Browser (client-side). A large part of
performance testing, up to this point, has been on the server side of
things. However, with the advancement of technology, HTML5, JS and CSS
improvements, more and more logic and behaviour have been pushed down
to the client. This adds to the overall perceived performance of
website/webapp, but this metric is not available in JMeter. Things
that add to the overall browser execution time may include:
Client-side Javascript execution - eg. AJAX, JS templates
CSS transforms - eg. 3D matrix transforms, animations
3rd party plugins - eg. Facebook like, Double click ads, site analytics, etc
All these things add to the overall browser execution time, and this
project aims to measure the time it takes to complete rendering all
this content.
Official guide: https://jmeter-plugins.org/wiki/WebDriverTutorial/
I've tried Badboy which is OK. The big, fat, heavy tool is SilkTest. It requires a lot of programming to get up and running, but you can get something very solid done!
If you only need to stress test request from e.g. IIS log files, I have a custom build tool. I will publish it at CodePlex very soon.
Selenium RC is another alternative.
Also related, check out my recent article on Ajaxian. I think it does a good job of explaining why real browsers do matter and why executing JavaScript is becoming more important for load testing.
http://ajaxian.com/archives/why-load-testing-ajax-is-hard
There's a new tool in this area called k6
it has a way to access the DOM, and I'm planning to try it in a project.
background story:
You can visit this and this blog.
maybe it will help.