Name Locator in Selenium IDE

NAME LOCATOR:

It is used to find the name in the web element.

If we have multiple web elements of the same name, then the first matched element would be returned.

  • Open the Firefox browser
  • Click on the Selenium icon, and it will open the Selenium IDE interface.
  • Now go to the Test Script Editor Box and click on the command text box.
NAME LOCATOR
  • Write the first command as:-

Command: open

Target: https://login.yahoo.com

Command open
  • This command loads the login page of yahoo on Firefox browser.
  • Then right-click on the username textbox and,
  • Click on inspect Element (Q).
command loads the login page of yahoo on Firefox browser
  • You will get a window contains all the specific codes involved in the Development Tool of the Username text box.
  • Then drag your mouse over the developer tools; you will see the highlighted area of the username textbox on the yahoo page.
  • Then select the name attribute that contains the specific name for the Username text box.
You will get a window contains all the specific codes involved
  • Now write the second command in selenium –IDE interface:-

Command: click

Target: name=username

Command click
  • The username Textbox is clicked.
  • Then we have to enter data in the text box, so for this, we will use the same name element.
  • The third command is:

Command: type

Target: name=username

Value: username

e.g.-xyz11@yahoo.com

username Textbox is clicked.
  • Then right-click on the Next button and,
  • Click on inspect Element (Q).
right-click on the Next button
  • You will get a window contains all the specific codes involved in the Development Tool of the next button.
  • Then drag your mouse over the developer tools; you will see the highlighted area of the username textbox on the yahoo page.
  • Then select the name attribute that contains the specific name for the Next button.
You will get a window contains all the specific codes involved in the Development Tool of the next button
  • Now write forth command in selenium –IDE interface:-

Command: click

Target: name=sign in

  • It will lead you to the next button on the browser.
It will lead you to the next button on the browser
  • Then Right-click on the password textbox then,
  • Click on inspect Element (Q)
  • You will get a window contains all the specific codes involved in the Development Tool of the Password text box.
  • Drag the mouse over the developer tools; you will see the highlighted area of the password textbox on the yahoo page.
  • Then select the name attribute that contains the specific name for the Password text box.
Right-click on the password
  • Now write the fifth command in selenium –IDE interface:-

Command: click

Target: name=password

  • The password text box is clicked.
  • Then we have to enter data in the text box, so for this, we will use the same name element.
  • The sixth command is:

Command: type

Target: name=password

Value: User password

 e.g.-*********

enter data in the text box
  • Then Right-click on the Sign-Up button then,
  • Click on inspect Element (Q).
Right-click on the Sign-Up button
  • You will get a window contains all the specific codes involved in the Development Tool of the Sign-Up text box.
  • You have moved the mouse over the developer tools; you will see the highlighted area of the Sign-Up textbox on the yahoo page.
  • Then select the name attribute that contains the specific name for the Sign-Up text box.
specific name for the Sign-Up text box
  • Then we have to enter data in the text box, so for this, we will use the same name element.
  • The sixth command is:

Command: click

Target: name=verifyPassword

we have to enter data in the text box
  • And click on the Run Current Test button.
  • It will execute all the inserted commands on the browser.
  • The Log pane is displaying the overall summary of the executed test scripts.
  • And you can see the executed command results in the Brower as well.
click on the Run Current Test button