T E S B O

Tesbo

Locators in Tesbo

Locators in Tesbo #

What is Locator in Tesbo? #

Locators in Tesbo is the similar as the locators in the Selenium as Tesbo using selenium underneath. All the locator need to declare into the JSON file inside the “locator” directory. 
Info:

One of the main difference is here is that Tesbo automatically take care of Locator type, 
so you don't need to mention locator type explicitly.

 To create the locators,  you’ll need to create anyfileName.json file inside the locator directory. you can create as many as JSON file to manage locators.  

Declaration of Locators : #

Below are the list of locators you can pass to the locators’s .json file. By ID 

{"LocatorName": "ID"}     

By XPath 

{"LocatorName": "Xpath"}

By className  

{"LocatorName": "ClassName"}

By Name

{"LocatorName": "Name"}

By TagName  

{"LocatorName": "TagName"}

By LinkText 

{"LocatorName": "LinkText"}

By PartialLinkText  

{"LocatorName": "PartialLinkText"}

        Following is the example of real .json file that will contains the locators of the element. here you can see you don’t need to define the locator type like id, xpath, className etc., Tesbo will automatically find out the locator time and perform action on it.  

      {
          "sign_in":"//div[contains(text(),'Hello. Sign in')]",
          "Email_Field":"//input[@type='email']",
          "continue":"continue",
          "Password_Field":"//input[@type='password']",
          "Login_Button":"signInSubmit" 
      }

Usage of Locator into Test #

Locator is required for the finding element on the page to perform action on it, locator element can be used with sign into the tests file.  e.g

Step : click on @sign_in

 So here, Tesbo will find the value of the sign_in key from the .json file, Find element based on It’s value and perform click event on the element.  Note :

As you can define multiple.json files into the "locator directory" for managing locators, 
it's very important that every "locator name (keys)" has Unique Value. 

Powered by BetterDocs

Leave a Comment