Thursday, 8 October 2015

Mouse Scrolling Event

How To Generate Mouse Scrolling Event Using Selenium IDE With Example


mouse scrolling event was missing from them till now. You need mouse scrolling event when you are testing software application like Facebook. In Facebook, post are loaded on mouse scrolling if you have seen. In this kind of scenario,
you need to generate mouse scrolling event in selenium IDE.

Let me give you an example. First of all open one page which contains vertical scroll bar(long description page) and then run bellow test case in selenium IDE.

New Test
CommandTargetValue
store40i
store0looptimes
whilestoredVars.looptimes <= 20
storeEvalselenium.browserbot.getCurrentWindow().scrollTo(0,${i})
storejavascript{storedVars.looptimes++;}
storeEval${i}+40i
endWhile


(Note : You need to attache user-extension.js file with selenium IDE to get support of "while" command in selenium IDE.
When you run above script in selenium IDE, it will scroll your page vertically if scroll bar is there on page.
  • You can change while loop value from '20' to your choice depending on length of page. If page is lengthy then increase that value.
  • 'selenium.browserbot.getCurrentWindow().scrollTo(0,${i})' is used with "storeEval" command for generating scroll event on page using selenium IDE. If you want to generate scroll event on horizontal scroll bar then use ''selenium.browserbot.getCurrentWindow().scrollTo(${i},0)''. It will create horizontal scrolling event on software web application page.
  • In above script you can change ${i}+40 --> ${i}+60 to increase or ${i}+40 --> ${i}+20 to decrease scrolling speed.
steps of downloading and installing user-extension.js file with selenium IDE
here are couple of advanced options available in selenium IDE like increasing timeout, attaching user extensions, attaching data file, and few other. Let describe here couple of them for your reference.

To open selenium IDE option window, Click on Options > Options from main menu. It will open option 
window as shown in bellow figure. Click on General tab.


Changing Default timeout in Selenium IDE
Look into above image, there is one text box with label "Default timeout value of recorded command in milliseconds". You can change default timeout value from that text box. By default, it will be 30000 milliseconds. Default timeout value affects on execution of selenium IDE script. Suppose you set 50000 milliseconds then during execution, every command can take maximum 50000 milliseconds for execution. If command can not complete execution in given time then selenium IDE will return error like "[error] Timed out after 30000 ms".

Attaching user extensions with selenium IDE
You can extend selenium IDE function by attaching your own made extensions(Only in .js format) as per your requirement. You can attach your extension in "Selenium Core extensions (user-extensions.js)" field.Simply click on browse button to select your user extension. You can attach multiple user extension files over there.

Click here to download user extension file for "while", "endWhile", "gotoIf", "gotoLabel" and "pushcommands.

(Note : Don't forget to restart selenium IDE after attaching user extension otherwise it will not affect and work)

Attaching data file with selenium IDE
There is one another field with name "Selenium IDE Extensions". Here you can attach data file(only in .js format)

(Note : Don't forget to restart selenium IDE after attaching data file otherwise it will not affect and work)

Remember Base URL
Used for remember last base URL. If selected then it will remember base URL which was used last time and appear in base URL field when you open selenium IDE window. If not selected then it will display blank when you open Selenium IDE.

Record assertTitle automatically
If selected, When you will navigate from one page to another page, Selenium IDE will add "assertTitle" command in your script during recording of selenium script.

Record absolute URL
If selected, Selenium will record absolute URL(with http: or https: Protocol) during recording.

Start recording immediately on open
If selected, selenium will start recording of script as soon as you open selenium IDE.
_______________________________________________________________________

Selenium IDE "focus" and "keyUp" commands with example

"focus" Command in Selenium IDE
"focus" is useful to set focus on targeted fields. Generally it is used with input fields like text box, text area, radio button, check box, button etc.. It will simply move cursor on targeted element or field.

Selenium "keyUp" Command
"keyUp" command is generally used with "keyDown" Command. Sometimes, "keyPress" command not
works in that case you can try combination of "keyDown" and "keyUp" command. "keyPress" works as user pressing and releasing a key while "keyDown" simulates a user pressing a key and "keyUp" for user releasing a key. In this way "keyPress" command = "keyDown" + "keyUp" commands.

Let we look "focus", "keyDown" and "keyUp" command with example.

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/p/blog-page.html
focus//input[@id='group_515952624_1']
keyDown//input[@id='group_515952624_1']\32
pause5000
keyUp//input[@id='group_515952624_1']\32

Above example will just select "Please be agree to publish your topic on our blog" check box and you can do it simply with "click" or "select" command but here my concern is to showing you an example of "focus" "keyDown" and "keyUp" commands.

  • 2nd command "focus" will set focus on "Please be agree to publish your topic on our blog" check box.
  • 3rd command, will press and hold 'space' key of keyboard.
  • 5th command will release 'space' key of keyboard.
Here, "keyPress" command is not working(you can try it) so that i used "keyDown" + "keyUp" commands as an alternate of "keyPress" command.

Selenium "shiftKeyDown" and "shiftKeyUp" commands example to press shift key

"shiftKeyDown" and "shiftKeyUp" commands are specially designed for shift key of keyboard. Selenium IDE has many commands related to keyboard keys(Example : keyDown) and mouse keys (Example :mouseDown). "shiftKeyDown" and "shiftKeyUp" has not major function but sometimes such specially
designed commands are very helpful in automation tools to automate your regression process easy and smooth.

Using "shiftKeyDown" Command
You can understand "shiftKeyDown" command's function from its name. It works like user is pressing and holding shift key of keyboard. Shift key not released until "shiftKeyUp" command executed.

Selenium IDE "shiftKeyUp" Command
"shiftKeyUp" command is useful to release pressed key through "shiftKeyDown" command. Bellow given example described both command's function very clearly.

New Test
CommandTargetValue
openhttp://www.google.com
shiftKeyDown

type//input[@id='gbqfq']hello friends
click//button[@id='gbqfb']
pause3000
shiftKeyUp

type//input[@id='gbqfq']hello friends
click//button[@id='gbqfb']

In above example, 1st "type" command will type word "HELLO FRIENDS" (in capital letter because shift key is pressed using "shiftKeyDown") in Google search box. 2nd type command will type "hello friends" in small letter because now shift key is released using "shiftKeyUp" in previous command.
________________________________________________________________

Select commands

                                                       Select commands


Working And Handling Multiple Windows In Selenium IDE

Working with the multiple windows in selenium IDE is not hard. Many selenium IDE users asking me for this question so let me try to explain it. You need to handle multiple windows many time of software applications regression testing using selenium IDE or any other tools. As you all knows, selenium IDE is not too much
powerful tool compared to others software testing tools like Webdriver,we have to handle few things manually in selenium IDE. Bellow given case is not fully recorded but updated few commands manually after recording. Let we look at the example.

New Test
CommandTargetValue
openhttp://www.bing.com
storeTitlei
openWindowhttps://www.google.com
pause5000
selectWindowGoogle
clickAndWaitcss=#gb_2 > span.gbts
storeTitlej
selectWindow${i}
clickAndWaitcss=#scpt1 > a
storeTitlei
selectWindow${j}
closej
selectWindow${i}
close


Handling Multiple Windows Test case explanation :
  • Selenium IDE will open 'bing' home page.
  • "storeTitle" will store bing home page title in variable 'i' to reuse it latter.
  • "openWindow" will open Google home page in new window and next pause command will pause selenium IDE for 5 secs.
  • Now we want to do some actions on newly opened window but we can not do any thing directly in new window. First of all we have to select new window. Next "selectWindow" command will select new window of Google home page.
  • Next command will click on Google's image link.
  • Now suppose i want to do some actions on parent 'bing' home page window. Before selecting parent window, "storeTitle" command will store latest title of page in variable 'j' so It will help selenium IDE to find this child window again when you want to perform some action on it.
  • Next commands will select parent 'bing' window and click on image link. (You can do more actions here.)
  • "selectWindow" command will select child window and next close command will close popup window.
  • Last 2 commands will do same thing on parent window.
Keep one thing in mind during navigating between multiple windows of software application - Before leaving current selected window, Always store latest window title of your current selected window and then select other windows. You can try above case with some other sites.

Selenium "verifySelectOptions", "verifySelectedLabel" and "verifySelectedIndex" Example

"verifySelectOptions", "verifySelectedLabel" and "verifySelectedIndex" commands works with drop down list box or multi select list box. Let me explain all of three first and then will see them with example.

Selenium IDE "verifySelectOptions" Command
"verifySelectOptions" command used for verification of list box option values. It will show error message if
defined values not available in list box. You can also use it for verification of option values. If not found match then selenium will return error message in log.

Using "verifySelectedLabel" Command in Selenium
As name suggect, "verifySelectedLabel" command will verify the name of selected label. If not found then selenium will return error message in log.

Selenium "verifySelectedIndex" Command
Every label contains index value in drop down and you can verify correct indexed label selection using "verifySelectedIndex" command. Let we see all three commands with example.

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
verifySelectOptionsname=FromLBUSA,Russia,Japan,Mexico,
India,Germany,Italy,Spain,
Malaysia,Greece
verifySelectOptionsname=FromLBRussia,Japan,Mexico,
India,Germany,Italy,Spain
selectname=FromLBlabel=Russia
verifySelectedLabelname=FromLBIndia
verifySelectedLabelname=FromLBRussia
verifySelectedIndexname=FromLB1
verifySelectedIndexname=FromLB5



In above example, all three commands inserted 2 times. one with incorrect value and one with correct value.
  • 1st "verifySelectOptions" command will pass because Actual value 'USA,Russia,Japan,Mexico,India,Germany,Italy,Spain,Malaysia,Greece' will match with targeted value 'USA,Russia,Japan,Mexico,India,Germany,Italy,Spain,Malaysia,Greece'.
  • 2nd "verifySelectOptions" command will Fail.
  • 1st "verifySelectedLabel" will be fail because current selected label 'Russia' will not match with 'India'.
  • 2nd "verifySelectedLabel" will be pass.
  • 1st "verifySelectedIndex" command will pass
  • 2nd "verifySelectedIndex" command will be fail because label 'Russia' has index = 1.
________________________________________________________________

Tuesday, 6 October 2015

How to use Locators in Selenium IDE

How to use Locators in Selenium IDE

Locators tell Selenium IDE which GUI elements ( say Text Box, Buttons, Check Boxes etc) its needs to operate on.  Identification of correct GUI elements is a prerequisite to create an automation script. But accurate identification of GUI elements is more difficult than it sounds. Sometimes, you end up working with incorrect GUI elements or no elements at all!  Hence, Selenium provides a number of Locators to precisely locate a GUI element.

The different types of locator are:
  •  ID
  •  Name
  •  Link Text
  •  CSS Selector
  •   Tag and ID
  •   Tag and class
  •   Tag and attribute
  •  Tag, class, and attribute
  •  Inner text
  •   DOM (Document Object Model)
  •   getElementById
  •   getElementsByName
  •   dom:name
  •   dom: index
  •  XPath

There are commands that do not need a locator (such as the "open" command). However, most of them do need Locators.
The choice of locator depends largely on your Application Under Test. In this tutorial, we will toggle between facebook, new tours.demoaut on the basis of locators that these applications support. Likewise in your testing project you will select any of the above listed locators based on your application support.

Locating by ID

This is the most common way of locating elements since ID's are supposed to be unique for each element.
Target Format: id=id of the element
For this example, we will use Facebook as our test app because Mercury Tours does not use ID attributes.
Step 1. Navigate to http://www.facebook.com. Inspect the "Email or Phone" text box using Firebug and take note of its ID. In this case, the ID is "email".

Step 2. Launch Selenium IDE and enter "id=email" in the Target box. Click the Find button and notice that the "Email or Phone" text box becomes highlighted with yellow and bordered with green, meaning, Selenium IDE was able to locate that element correctly.

Locating by Name

Locating elements by name are very similar to locating by ID, except that we use the "name=" prefix instead.
Target Format: name=name of the element
In the following demonstration, we will now use Mercury Tours because all significant elements have names.
Step 1. Navigate to http://newtours.demoaut.com/ and use Firebug to inspect the "User Name" text box. Take note of its name attribute.
Here, we see that the element's name is "username".
Step 2. In Selenium IDE, enter "name=username" in the Target box and click the Find button. Selenium IDE should be able to locate the User Name text box by highlighting it.

Locating by Name using Filters

Filters can be used when multiple elements have the same name. Filters are additional attributes used to distinguish elements with the same name.
Target Format: name=name_of_the_element filter=value_of_filter
Let's see an example -
Step 1. Log on to Mercury Tours using "tutorial" as the username and password. It should take you to the Flight Finder page shown below.
Step 2. Using Firebug, notice that the Round Trip and One Way radio buttons have the same name "tripType." However, they have different VALUE attributes so we can use each of them as our filter.
Step 3.
  • We are going to access the One Way radio button first. Click the first line on the Editor.
  • In the Command box of Selenium IDE, enter the command "click".
  • In the Target box, enter "name=tripType value=oneway".  The "value=oneway" portion is our filter.
Step 4. Click the Find button and notice that Selenium IDE is able to highlight the One Way radio button with green - meaning that we are able to access the element successfully using its VALUE attribute.
Step 5. Press the "X" key in your keyboard to execute this click command. Notice that the One Way radio button became selected.
You can do the exact same thing with the Round Trip radio button, this time, using "name=tripType value=roundtrip" as your target.

Locating by Link Text

This type of locator applies only to hyperlink texts. We access the link by prefixing our target with "link=" and then followed by the hyperlink text.
Target Format: link=link_text
In this example, we shall access the "REGISTER" link found in the Mercury Tours homepage.
Step 1.
  • First, make sure that you are logged off from Mercury Tours.
  • Go to Mercury Tours homepage.
Step 2.
  • Using Firebug, inspect the "REGISTER" link. The link text is found between and tags.
  • In this case, our link text is "REGISTER". Copy the link text.
Step 3. Copy the link text in Firebug and paste it onto Selenium IDE's Target box. Prefix it with "link=".
Step 4. Click on the Find button and notice that Selenium IDE was able to highlight the REGISTER link correctly.
Step 5. To verify further, enter "clickAndWait" in the Command box and execute it. Selenium IDE should be able to click on that REGISTER link successfully and take you to the Registration page shown below.

Locating by CSS Selector

CSS Selectors are string patterns used to identify an element based on a combination of HTML tag, id, class, and attributesLocating by CSS Selector is more complicated than the previous methods, but it is the most common locating strategy of advanced Selenium users because it can access even those elements that have no ID or name.
CSS Selectors have many formats, but we will only focus on the most common ones.
  • Tag and ID
  • Tag and class
  • Tag and attribute
  • Tag, class, and attribute
  • Inner text
When using this strategy, we always prefix the Target box with "css=" as will be shown on the following examples.

Locating by CSS Selector - Tag and ID

Again, we will use Facebook's Email text box in this example. As you can remember, it has an ID of "email" and we have already accessed it in the "Locating by ID" section. This time, we will use a CSS Selector with ID in accessing that very same element.
Syntax
Description
css=tag#id
  • tag = the HTML tag of the element being accessed
  • # = the hash sign. This should always be present when using a CSS Selector with ID
  • id = the ID of the element being accessed
Keep in mind that the ID is always preceded by a hash sign (#).
Step 1. Navigate to www.facebook.com. Using Firebug, examine the "Email or Phone" text box.
At this point, take note that the HTML tag is "input" and its ID is "email". So our syntax will be "css=input#email".
Step 2. Enter "css=input#email" into the Target box of Selenium IDE and click the Find button. Selenium IDE should be able to highlight that element.

Locating by CSS Selector - Tag and Class

Locating by CSS Selector using an HTML tag and a class name is similar to using a tag and ID, but in this case, a dot (.) is used instead of a hash sign.
Syntax
Description
css=tag.class
  • tag = the HTML tag of the element being accessed
  • . = the dot sign. This should always be present when using a CSS Selector with class
  • class = the class of the element being accessed

Step 1. Navigate to www.facebook.com and use Firebug to inspect the "Email or Phone" text box. Notice that its HTML tag is "input" and its class is "inputtext".
Step 2. In Selenium IDE, enter "css=input.inputtext" in the Target box and click Find. Selenium IDE should be able to recognize the Email or Phone text box.
Take note that when multiple elements have the same HTML tag and name, only the first element in source code will be recognized. Using Firebug, inspect the Password text box in Facebook and notice that it has the same name as the Email or Phone text box.
The reason why only the Email or Phone text box was highlighted in the previous illustration is that it comes first in Facebook's page source.

Locating by CSS Selector - Tag and Attribute

This strategy uses the HTML tag and a specific attribute of the element to be accessed.
Syntax
Description
css=tag[attribute=value]
  • tag = the HTML tag of the element being accessed
  • [ and ] = square brackets within which a specific attribute and its corresponding value will be placed
  • attribute = the attribute to be used. It is advisable to use an attribute that is unique to the element such as a name or ID.
  • value = the corresponding value of the chosen attribute.

Step 1. Navigate to Mercury Tours' Registration page (http://newtours.demoaut.com/mercuryregister.php) and inspect the "Last Name" text box. Take note of its HTML tag ("input" in this case) and its name ("lastName").
Step 2. In Selenium IDE, enter "css=input[name=lastName]" in the Target box and click Find. Selenium IDE should be able to access the Last Name box successfully.
When multiple elements have the same HTML tag and attribute, only the first one will be recognized. This behavior is similar to locating elements using CSS selectors with the same tag and class.

Locating by CSS Selector - tag, class, and attribute


Syntax
Description
css=tag.class[attribute=value]
  • tag = the HTML tag of the element being accessed
  • . = the dot sign. This should always be present when using a CSS Selector with class
  • class = the class of the element being accessed
  • [ and ] = square brackets within which a specific attribute and its corresponding value will be placed
  • attribute = the attribute to be used. It is advisable to use an attribute that is unique to the element such as a name or ID.
  • value = the corresponding value of the chosen attribute.

Step 1. Navigate to www.facebook.com and use Firebug to inspect the 'Email or Phone' and 'Password' input boxes. Take note of their HTML tag, class, and attributes. For this example, we will select their 'tabindex' attributes.
Step 2.  We will access the 'Email or Phone' text box first, thus, we will use a tabindex value of 1. Enter "css=input.inputtext[tabindex=1]" in Selenium IDE's Target box and click Find. The 'Email or Phone' input box should be highlighted.
Step 3. To access the Password input box, simply replace the value of the tabindex attribute. Enter "css=input.inputtext[tabindex=2]" in the Target box and click on the Find button. Selenium IDE must be able to identify the Password text box successfully.

Locating by CSS Selector - inner text

As you may have noticed, HTML labels are seldom given id, name, or class attributes. So, how do we access them? The answer is through the use of their inner texts. Inner texts are the actual string patterns that the HTML label shows on the page.
Syntax
Description
css=tag:contains("inner text")
  • tag = the HTML tag of the element being accessed
  • inner text = the inner text of the element

Step 1. Navigate to Mercury Tours' homepage (http://newtours.demoaut.com/) and use Firebug to investigate the "Password" label. Take note of its HTML tag (which is "font" in this case) and notice that it has no class, id, or name attributes.
Step 2. Type css=font:contains("Password:") into Selenium IDE's Target box and click Find. Selenium IDE should be able to access the Password label as shown on the image below.
Step 3. This time, replace the inner text with "Boston" so that your Target will now become "css=font:contains("Boston")". Click Find. You should notice that the "Boston to San Francisco" label becomes highlighted. This shows you that Selenium IDE can access a long label even if you just indicated the first word of its inner text.

Locating by DOM (Document Object Model)

The Document Object Model (DOM), in simple terms, is the way by which HTML elements are structured. Selenium IDE is able to use the DOM in accessing page elements. If we use this method, our Target box will always start with "dom=document..."; however, the "dom=" prefix is normally removed because Selenium IDE is able to automatically interpret anything that starts with the keyword "document" to be a path within the DOM anyway.
There are four basic ways to locate an element through DOM:
  • getElementById
  • getElementsByName
  • dom:name (applies only to elements within a named form)
  • dom:index
Locating by DOM - getElementById
Let us focus on the first method - using the getElementById method. The syntax would be:
Syntax
Description
document.getElementById("id of the element")
id of the element = this is the value of the ID attribute of the element to be accessed. This value should always be enclosed in a pair of parentheses ("").

Step 1. Navigate to www.facebook.com and use Firebug to inspect the "Keep me logged in" check box. Take note of its ID.
We can see that the ID we should use is "persist_box".
Step 2. Open Selenium IDE and in the Target box, enter "document.getElementById("persist_box")" and click Find. Selenium IDE should be able to locate the "Keep me logged in" check box. Though it cannot highlight the interior of the check box, Selenium IDE can still surround the element with a bright green border as shown below.

Locating by DOM - getElementsByName

The getElementById method can access only one element at a time, and that is the element with the ID that you specified. The getElementsByName method is different. It collects an array of elements that have the name that you specified. You access the individual elements using an index which starts at 0.

   getElementById
  • It will get only one element for you.
  • That element bears the ID that you specified inside the parentheses of getElementById().
  getElementsByName
  • It will get a collection of elements whose names are all the same.
  • Each element is indexed with a number starting from 0 just like an array
  • You specify which element you wish to access by putting its index number into the square brackets in getElementsByName's syntax below.

Syntax
Description
document.getElementsByName("name")[index]
  • name = name of the element as defined by its 'name' attribute
  • index = an integer that indicates which element within getElementsByName's array will be used.

Step 1. Navigate to Mercury Tours' Homepage and login using "tutorial" as the username and password. Firefox should take you to the Flight Finder screen.
Step 2. Using Firebug, inspect the three radio buttons at the bottom portion of the page (Economy class, Business class, and First class radio buttons). Notice that they all have the same name which is "servClass".
Step 3. Let us access the "Economy class" radio button first. Of all these three radio buttons, this element comes first so it has an index of 0. In Selenium IDE, type "document.getElementsByName("servClass")[0]" and click the Find button. Selenium IDE should be able to identify the Economy class radio button correctly.
Step 4. Change the index number to 1 so that your Target will now become document.getElementsByName("servClass")[1]. Click the Find button and Selenium IDE should be able to highlight the "Business class" radio button, as shown below.

Locating by DOM - dom:name

As mentioned earlier, this method will only apply if the element you are accessing is contained within a named form.
Syntax
Description
document.forms["name of the form"].elements["name of the element"]
  • name of the form = the value of the name attribute of the form tag that contains the element you want to access
  • name of the element = the value of the name attribute of the element you wish to access

Step 1. Navigate to Mercury Tours homepage (http://newtours.demoaut.com/) and use Firebug to inspect the User Name text box. Notice that it is contained in a form named "home".
Step 2. In Selenium IDE, type "document.forms["home"].elements["userName"]" and click the Find button. Selenium IDE must be able to access the element successfully.

Locating by DOM - dom:index

This method applies even when the element is not within a named form because it uses the form's index and not its name.
Syntax
Description
document.forms[index of the form].elements[index of the element]
  • index of the form = the index number (starting at 0) of the form with respect to the whole page
  • index of the element = the index number (starting at 0) of the element with respect to the whole form that contains it

We shall access the "Phone" text box within Mercury Tours Registration page. The form in that page has no name and ID attribute so this will make a good example.
Step 1. Navigate to Mercury Tours Registration page and inspect the Phone text box. Notice that the form containing it has no ID and name attributes.
Step 2. Enter "document.forms[0].elements[3]" in Selenium IDE's Target box and click the Find button. Selenium IDE should be able to access the Phone text box correctly.
Step 3. Alternatively, you can use the element's name instead of its index and obtain the same result. Enter "document.forms[0].elements["phone"]" in Selenium IDE's Target box. The Phone text box should still become highlighted.

Locating by XPath

XPath is the language used when locating XML (Extensible Markup Language) nodes. Since HTML can be thought of as an implementation of XML, we can also use XPath in locating HTML elements.
        Advantage: It can access almost any element, even those without class, name, or id attributes.
        Disadvantage: It is the most complicated method of identifying elements because of too many different rules and considerations.
Fortunately, Firebug can automatically generate XPath locators. In the following example, we will access an image that cannot possibly be accessed through the methods we discussed earlier.
Step 1. Navigate to Mercury Tours Homepage and use Firebug to inspect the orange rectangle to the right of the yellow "Links" box. Refer to the image below.
Step 2. Right click on the element's HTML code and then select the "Copy XPath" option.
Step 3. In Selenium IDE, type one forward slash "/" in the Target box then paste the XPath that we copied in the previous step. The entry in your Target box should now begin with two forward slashes "//".
Step 4. Click on the Find button. Selenium IDE should be able to highlight the orange box as shown below.

Summary

Syntax for Locator Usage
Method
Target Syntax
Example
By IDid= id_of_the_elementid=email
By Namename=name_of_the_elementname=username
By Name Using Filtersname=name_of_the_elementfilter=value_of_filtername=tripType value=oneway
By Link Textlink=link_textlink=REGISTER
Tag and IDcss=tag#idcss=input#email
Tag and Classcss=tag.classcss=input.inputtext
Tag and Attributecss=tag[attribute=value]css=input[name=lastName]
Tag, Class, and Attributecss=tag.class[attribute=value]css=input.inputtext[tabindex=1]

________________________________________________________________