Posts

Showing posts with the label locators

What is JavascriptExecutor in Selenium?

Image
In Selenium Webdriver, locators like ID, Name, XPath, CSS, etc. are used to identify and perform operations on a web page. And there are certain cases when these locators do not work. Here I am talking about some examples and these are from my first-hand experience. Let's get started- Case 1: In this case, we talk about elements that show up on UI and works fine when interacted manually but not using code. You cannot reach these elements in desired or conventional ways and performs actions on them using the locators in Selenium. Like, a click action on a radio button or a checkbox or a normal button. What you see in the below screenshot is one such button named Publish. This element is not interactable when we approach it with any kind of locator in Selenium. But manually it works as expected. Well, that’s a different story of how this happened. This is a low priority issue because the element is behaving as expected when tested manually. So we are not bothered to...

What is UI Map in Selenium?

Image
UI Map (User Interface Map) also termed as Object repository is a concept in Selenium for defining, storing, and serving UI elements of an application. It contains a set of ‘key-value’ pairs, where the key is an alias of the UI element, and a value is a locator. It can be defined in the very famous properties file or in a static class inside your project. To understand it even more clearly you need to understand what are Locators . To perform any action we need locators of a UI element. Webdriver will perform any action based on the locators. For each and every action Webdriver (or any such tool) depends on these locators. If the Webdriver does not identify the locators, it simply throws an error as Locator / Element Not Found or Identified. In order to make sure the Webdriver executes smoothly, we need to provide an accurate unique identifier/locators. We need to keep all the locators related to one page or components (in case of single page applications) at one p...