Sample UI Element Mapping

UI-Element is what we saw as controls or elements in each page . Its simply know as object repositories UI Element mapping is where the object references are stored. UI-Element Mapping is available in Selenium IDE as user extension.
Why UI Elements have to stored and mapped?

Mainly because of Readability and Maintainability.
Eg. We can give the Login ID text box name as "txt_Lgn" and we can record it as
Selenium.type ("txt_Lgn", "bob");
after UI mapping it suppose to show as
Selenium.type ("ui:Signinpage::TextboxLogin()", "bob");
It will be easily understandable and if the id got changed from "txt_Lgn" to  "txt_Login" We don't need to replace where ever we used this. We can just change from Map file alone.

Sample UI Map file:
var myMap = new UIMap();
myMap.addPageset({
name: 'SignInPage'
, description: 'My App Sign in Page'
, pathRegexp: '.*'});
myMap.addElement('SignInPage', {name: 'UserNameTextBox', description: 'UserName Text Box',
locator: "ctl00_mainContentPlaceHolder_txt_LoginName"});
myMap.addElement('SignInPage', {name: 'PasswordTextBox', description: 'Password Text box on Sign In Page',
locator: "ctl00_mainContentPlaceHolder_txt_Password"});
myMap.addElement('SignInPage', {name: 'LoginButton', description: 'Login Button on Sign In Page',
locator: "ctl00_mainContentPlaceHolder_btn_login"});


Steps to Add the UI Map file in to Selenium IDE:
1.This file has to be created as Javascript file with .js extension.
2.Open Selenium IDE.
3.Select Option --->Options.

4.Under Selenium Core Extensions (user extension.js), Browse the above created UIMap.js file and click OK.
5.Close and Open the Selenium IDE to get the UIMap file activated.
Now Try to record the your case you can find the changed element id.

11 comments:

  1. Good stuff. its very userfull

    ReplyDelete
  2. Thanks. It helped me :)

    ReplyDelete
  3. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  4. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
    Selenium

    ReplyDelete
  5. Advanced Selenium Framework Training in Chennai by Vishwa

    Hi, Reach Mr.Vishwa for Best Selenium and Coded UI Training in Chennai with real time project assistance. This people will teach everything from the basics up to advanced level scenarios from frameworks.

    I learned from Mr.Vishwa and Raj they are very good automation people for Selenium Frameworks. After joined with them I learned many things and now I am writing automation scripts in own project. Vishwa 9003085882
    selenium training in chennai

    ReplyDelete

  6. The biggest change in Selenium recently has been the inclusion of the WebDriver API. Driving a browser natively as a user would either locally or on a remote machine using the Selenium Server it marks a leap forward in terms of browser automation.

    Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as Selenium 2.
    Selenium Training Institute in Chennai

    Selenium Training in Velachery

    ReplyDelete
  7. Automation testing mainly focus on test data design tips and needs java knowledge.So we need to get Best Java training in chennai

    ReplyDelete
  8. nice blog...The leading training concern THE CREATING EXPERTS are providing SELENIUM training and here is the link

    http://thecreatingexperts.com/selenium-training-in-chennai/

    contact 8122241286

    ReplyDelete
  9. Thanks for sharing this blog.Creating Experts provides Best training in selenium

    http://thecreatingexperts.com/selenium-training-in-chennai/

    contact 8122241286

    ReplyDelete
  10. The Creating Experts provides training in SELENIUM

    They provide hands on training with real time scenarios

    http://thecreatingexperts.com/selenium-training-in-chennai/

    contact +91-08122241286

    ReplyDelete