Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Front End Automation Strategies 1 – Don’t Write Complex XPath/CSS – Ask For Static Locators Instead

Posted on 02/19/2025 By admin

I am starting a series of posts on best strategies to be followed in front end automation. Here is the first post.

“Locators‘ are the backbone of front end automation. Your script does not see the actual UI/UX and perform the action. It depends on DOM where HTML tags and its attributes are defined.

Maximum front end automation tool provides locators to locate web element of web page and perform desired actions on it. The best locator strategies are ID and NAME.

I see many web applications where developers do not provided proper attribute such as ID or name to HTML elements and automation testers try to write complex xpath/css to locate web element and may end up with unstable script. Minor changes in DOM structure may fail your test script. There is no meaning if you need to keep maintaining your scripts frequently because of locator issues. It takes time and effort.

Now a days automation is not the story to be done when application is completely build and stable. Many organization do it parallely with manual testing within sprint or some do only automation testing. So you can not waste time in just locating web elements.

We should ask for static locators preferrably an ID or unique name to web elements. I can list out some advantages of static locators below:

  1. It saves a lot of time as you just need to pick the ID or name and use.
  2. ID and Name are the fastest locators among all which may decrease your test execution time.
  3. Change in DOM structure will not impact your already created script much.
  4. You can focus more on validation rather than wasting time in finding locators.
  5. You can achieve stability of automation script. You must have experienced that max failures of automation script is because of locator issue.

If you are automating a web application which is under development, you must ask for it as completing a project successfully is a team’s responsibility. Providing proper locators is under developer control and which must be done for the sake of stability of project.

If you would like to share some best strategies you followed in your project, let me know by shooting an email at [email protected]. I will love to share that knowledge with QA community with your details.

If you like my posts, please like, comment and share to reach maximum.

#ThanksForReading

Uncategorized

Post navigation

Previous Post: Advanced TestNG Tutorials 33: Integration and Usage of BeanShell In TestNG XML
Next Post: Postman Tutorial Part 24 -Set, Get and Unset Global & Environment Variables in Postman Scripts

Related Posts

image – Make Selenium Easy Uncategorized
onlyMainPackageCLass – Make Selenium Easy Uncategorized
Core Java Quiz – 2 – Arrays Uncategorized
August 15, 2018 – Make Selenium Easy Uncategorized
April 2017 – Make Selenium Easy Uncategorized
TestNG Tutorials 53: DataProvider in TestNG – Is It Mandatory To Have Return Type as Object in DataProvider Method Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark