Friday 29 June 2012

Selenium WebDriver Installation


WebDriver is a clean, fast framework for automated testing of webapps. Selenium WebDriver is not tied to any particular test framework.


Google Opensource blog says: WebDriver takes a different approach to solve the same problem as Selenium. Rather than being a JavaScript application running within the browser, it uses whichever mechanism is most appropriate to control the browser. For Firefox, this means that WebDriver is implemented as an extension. For IE, WebDriver makes use of IE's Automation controls. By changing the mechanism used to control the browser, we can circumvent the restrictions placed on the browser by the JavaScript security model. In those cases where automation through the browser isn't enough, WebDriver can make use of facilities offered by the Operating System. For example, on Windows we simulate typing at the OS level, which means we are more closely modeling how the user interacts with the browser, and that we can type into "file" input elements.

For in-depth knowledge on Selenium WebDriver, see here.

Below are few links to help you in the process of Selenium WebDriver installation:
1. WebDriver for Chrome [Link]
2. Setting Up a Selenium-WebDriver Project [Link]
3. Installing Selenium Webdriver on Ubuntu 11 [Link]
4. Installing Selenium Webdriver (selenium-dotnet-2.20.0.zip) [Link]
5. Setting Up a Selenium-WebDriver Project [Link]
6. Selenium Webdriver for Python installation [Link 1] [Link 2]
7. Python - Getting Started With Selenium WebDriver on Ubuntu/Debian [Link]
8. Get started with Selenium 2 [Link]
10. Selenium WebDriver AndroidDriver [Link]

Selenium - Uploading a File

If you are trying to upload a file using Selenium and are stuck then below links may help you. Below are 10 links to help you upload a file using Selenium automation testing tool.

1.
Selenium RC with Junit framework - upload a file using attachFile() method - [Link]

2.
Selenium - Uploading Files in Remote WebDriver - [Link]

3.
Selenium - Upload files on browsers running over remote machines [Link]

4.
Selenium: Upload file in Google Chrome - [Link]

5.
How to deal with file uploading in test automation using selenium or webdriver - [Link]

6.
Webdriver: File Upload - [Link]

7.
How to upload a file using Selenium in Java - [Link]

8.
How to upload a file in selenium - AutoIT - [Link]

9.
Selenium RC: How to Upload and Submit Files Using Selenium and AutoIt - [Link]

10.
Selenium Upload/Download file handling - [Link]

Selenium Element Locator Examples

An element Locator tells Selenium which HTML element a command refers to. The format of a locator is:

locatorType=argument 

Below are some of the awesome links to help you understand Selenium element locator in a better way:

1. Selenium Tutorial : Locators [Link]

2. Locating page elements using WebDriver [Link]

3. How to locate elements in Selenium IDE? [Link]

4. A Quick Introduction to CSS Locators in Selenium [Link]

5. Selenium Element Locators [Link]

6. Selenium Tips: Start improving your locators [Link]

7. Selenium Tips: CSS Selectors in Selenium Demystified [Link]

8. Selenium: Is it possible to use the regexp in selenium locators [Link]

9. How to use regex in selenium locators [Link]

10. Selenium IDE with an XPath Locator [Link]

11. When to use which element locator, element locator use in selenium Xpath,CSS, DOM [Link]

Selenium WebDriver Page Objects


The Page Object pattern represents the screens of your web app as a series of objects. There is a PageFactory in the support package that provides support for this pattern, and helps to remove some boiler-plate code from your Page Objects at the same time.


Below you can find few awesome links on Page Objects in order to understand these in depth:

1. Page Objects in Selenium 2.0
In this post the author looks at the difference between test specification and test implementation and how Selenium achieves this with page objects. [Link]

2. Using Page Objects with Selenium and Web Driver 2.0. [Link]

3. Good explanation of Page Objects, Implementation Notes and an example. [Link]

4. Selenium Page Object Pattern
This post makes you understand how to apply the Page Object design pattern. [Link]

5. Automated Testing Using Page Objects and WebDriver. [Link]

6. Selenium WebDriver: Page Object Pattern and PageFactory. [Link]
This post explains Page Object Pattern, main advantages of Page Object Pattern, Why use PageFactory? and much more.

7. Selenium PageObjects and PageFactory.
This article discusses the PageObject design pattern and a factory class from WebDriver support libraries. [Link]

8. Abstracting Web Page Interaction. [Link]

9. Selenium 2/Web Driver - the Land Where Page Objects are King! [Link]

10. Page Object Model – Introduction - (infact all posts related to Page Object Model, using Integrate Development Environment, called Eclipse). [Link]

11. Page Objects design issues. [Link]

12. Selenium webdriver page object.
It is tough to figure out how to define each page object BUT lets say I have figured that out and defined several page objects that represent our site.
How do you handle crossing from page to page. So I get a page object for my home page and one for my account page and one for my results page. Then I need to write a test that traverses all my pages to simulate a user performing multiple actions. [Link]

13. The PageObject pattern for Selenium WebDriver UI tests. [Link]

14. Selenium Page Objects and Abstraction (explanation that relates the page object pattern to the concept of abstraction in programming). [Link]

15. WebDriver: How to check if an page object web element exists? [Link]

Taking Screenshots with Selenium WebDriver

Take a screenshot with Selenium WebDriver

Testers do take screenshots while testing, its important in many ways. So can you take screenshots using Selenium WebDriver? The answer is yes. Below you can find few good links that show you how to take screenshots with Selenium WebDriver:

1. This StackOverflow link has an example from Java, Python, Ruby, Jython [Link]

2. Taking screenshots with Selenium WebDriver (Selenium Client Driver for C#) [Link]

3. Taking screenshot of flash object using Selenium with Webdriver [Link]

4. Taking a Screenshot with Selenium Remote Webdriver - Java, Csharp, Python, Ruby [link]

5. If capture screenshot functionality with remote webdriver implementation throws Class Cast Exception [java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver cannot be cast to org.openqa.selenium.TakesScreenshot], then take a look here.

6. How to take an OS level screen capture using ruby selenium webdriver [Link]

7. How to Take Screenshots during Selenium Test Execution [Link]

Selenium Webdriver & Excel


Selenium Webdriver & Excel



Below are some of the links which will help you to work with Excel [.XLSX files] using Selenium Webdriver:

1. DataProvider - Data Driven Testing with Selenium and TestNG. [Link]

2. Parameterization of Selenium Tests with Microsoft Excel. [Link]

3. Data driven testing In Selenium using JXL (Part 1). [Link]

4. Data Driven Testing in Selenium using JXL (Part 2). [Link]

5. Using POI API to work with Excel (.XLSX file). [Link1][Link2 - Actual Code]

6. Reading writing from Excel files for selenium automation testing framework design. [Link]

7. Apache POI - Read Excel - For use of Selenium TestNG DataProvider. [Link]

8. Selenium - Reading test data from XLS (MS Excel) using Apache POI. [Link]

9. Hybrid Testing (Data + Keyword Driven) using Selenium. [Link]

10. Data-driven tests with JUnit 4 and Excel. [Link]

11. Lastly this selenium Wiki might help. [Link

org.openqa.selenium.WebDriverException: Permission denied for to get property Window.frameElement

This summary is not available. Please click here to view the post.

Thursday 21 June 2012

Create an effective mobile site


Create an effective mobile site

Just because you can see your desktop website on a mobile phone doesn't mean that it's mobile-friendly. People who use high-end mobile devices, like iPhones or Android phones, can see standard AdWords ads and standard websites. But other possible customers use WAP mobile phones, which can only view specially designed mobile websites.
To reach the most mobile customers, it helps to create a mobile website that's tailored to the small screen and makes it easy for people to make a purchase or take other action on your site.
When designing your site, keep in mind mobile best practices, like simple navigation and highlighting local options of your business. If you'd like to reach customers with WAP phones, you'll also need to use mobile-friendly code to create your site.

Reaching mobile customers using a normal (HTML) website

Regardless of whether you have a mobile website, AdWords will let you show text ads to customers using Google Search on a high-end mobile device, like an iPhone or Android phone. These "smart phones" have a full Internet browser (like a desktop computer), so a customer who clicks your standard-sized text ad from the search results page can visit your standard website written with HTML.
By default, AdWords opts your new campaigns into "all available devices," which includes these "mobile devices with full browsers." You can opt in or out of showing ads on "Mobile devices with full browsers" from each campaign's Settings tab.

Keep in mind...

If you opt in, make sure that your landing page doesn't contain Flash content. Flash is currently not supported on iPhones or iPads, and has only limited support on Android and other high-end mobile devices. If our system detects that your landing page has lots of Flash content, we'll automatically limit your ads from running on high-end mobile devices.

Create a longer text ad

About longer text ads for Eastern Europe and Asia
Nowadays, many mobile devices have standard browsers, but some feature phones lack a full browser and can only view mobile-specific webpages. To reach customers on these devices, you'll need to create a WAP [mobile ad] and a WAP-friendly mobile website, which we'll talk about more below.

Best practices for designing a mobile site

When creating a mobile website, you'll want to keep in mind a few strategies that best take advantage of the small size of mobile screens and the behavior of mobile users. These strategies can help make sure your mobile site is a great experience for customers and direct them to take the desired actions on your site.
Keep it quick
  1. Reduce large blocks of text and use bullet points.
  2. Compress images to keep them small for faster site loading.
Make it easy to buy something or contact you.
  1. Reduce the number of steps needed to complete a transaction.
  2. Keep forms short, with the fewest number of fields possible.
  3. Use check boxes, lists, and scroll menus to make data entry easier.
  4. Use click-to-call functionality for all phone numbers.
Simplify navigation
  1. Minimize scrolling and keep it vertical only.
  2. Use a clear hierarchy in menus and avoid rollovers.
  3. Help customers navigate between levels with clear back and home buttons.
  4. Use seven links or fewer per page of navigation.
Help people find and get to your local sites
  1. Have your address or store locator on the landing page.
  2. Include maps and directions. Use GPS to personalise when possible.
  3. Allow customers to check stock at nearby stores.

Designing sites for WAP mobile phones

While desktop websites typically are written with HTML, a landing page for a WAP device will need to be written in a different coding language. WAP-friendly mobile websites can be written in a few different markup languages, including XHTML, CHTML, and WML. Each language is compatible with different mobile devices.
By considering which devices you'd most like your ad to appear on, you can best plan which language or languages you should use to create your mobile website.
Detailed instructions for creating a website in mobile-friendly code are available in theWebmaster Help Center.

Tip

Don't have coding skills? Visit our mobile resources site to find a developer who can help you create a mobile version of your website.
Once your mobile website is ready, make sure to set up a WAP mobile ad so you can reach the right customers.
If you already have a mobile-friendly website, but you're not sure what the markup language is, or want to confirm, here's how to find out.

Tip

Once you're all set with your mobile website, make sure that the WAP mobile ads you create are set to display in the correct markup language(s) in which your mobile site is written. You'll see this step while you're creating or editing a WAP ad, under "Specify the markup language in which your mobile website is written".