TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Selenium IDE- Locating Strategies By Identifier

Selenium IDE- Locating Strategies By Identifier with Introduction, features, selenium basic terminology, what is selenium, selenium limitations, selenium vs qtp, tool suite, selenium ide, ide-installation, ide-features, ide-first test case, ide-commands, ide-creating test cases manually, ide-login test etc.

<< Back to SELENIUM

Selenium IDE- Locating Strategies (By Identifier)

  • Identifier was used as a default type earlier and not recommended now as it's not supported by WebDriver.
  • With identifier, we can use locating strategies like ID and Name both.
  • The first element with the matching ID attribute is used.
  • If no element has a matching ID attribute then the first element with a matching name attribute is used.
  • For example, Identifier=login (this could be ID or Name).

Let us consider an example on how to use Identifier locator as a target for commands in Selenium IDE.

We will create a login test, so that you could get a better understanding of locating elements through Identifier.

  • Launch Firefox browser.
  • Click on the Selenium icon present on the top right corner on your browser.
  • It will launch the default interface of Selenium IDE.
  • Click on the command text box present on the Test Script Editor Box.

Selenium IDE- Locating Strategies By Identifier

Selenium IDE- Locating Strategies By Identifier

For second command to be entered, we need a unique identification element for the Username text box which will help the IDE to identify the target location.

    • Right click on the "Username" text box and select Inspect Element.

Selenium IDE- Locating Strategies By Identifier
    • It will launch a window containing all the specific codes involved in the development of the "Username" text box.

Selenium IDE- Locating Strategies By Identifier
    • Pick the first element with the matching ID attribute that contains the specific ID for the "Username" text box.

Selenium IDE- Locating Strategies By Identifier
  • Modify the properties of second command as:
    • Command: click at
    • Target: identifier=login1
    • After execution, this command will click on the Username text box.

Selenium IDE- Locating Strategies By Identifier

We will use the same identifier element for our next command.

  • Modify the properties of third command as:
    • Command: type
    • Target: identifier=login1
    • Value: username
    • After execution, this command will type the username in the Username text box.

Selenium IDE- Locating Strategies By Identifier

We will now add a command that will click on the "Password" text box. For this command, we need a unique identification for the "Password" field which will help the IDE to identify the target location.

    • Right click on the "Password" text box and select Inspect Element.

Selenium IDE- Locating Strategies By Identifier
    • It will launch a window containing all the specific codes involved in the development of the "Password" text box.

Selenium IDE- Locating Strategies By Identifier
    • Pick the first element with the matching ID attribute that contains the specific ID for the "Password" text box.

Selenium IDE- Locating Strategies By Identifier
  • Modify the properties of fourth command as:
    • Command : click at
    • Target : identifier=password
    • After execution, this command will click on the Password text box.

Selenium IDE- Locating Strategies By Identifier

We will use the same ID element for our next command which involves typing the password as login credential.

  • Modify the properties of fifth command as:
    • Command : type
    • Target : identifier=password
    • Value : **********(User Login Password)
    • Upon execution this command will type the user password as the login credential.

Selenium IDE- Locating Strategies By Identifier

At last, we need a unique identification element for the Login Submit button which will help the IDE to identify the target location.

    • Right click on the "Go" button and select Inspect Element.

Selenium IDE- Locating Strategies By Identifier
    • It will launch a window containing all the specific codes involved in the development of the "Go" submit button.

Selenium IDE- Locating Strategies By Identifier
    • Pick the first element with the matching name attribute that contains the specific name for the "Go" submit button.

Selenium IDE- Locating Strategies By Identifier
  • Modify the properties of sixth command as:
    • Command : click at
    • Target : identifier=proceed
    • After execution, this command will click on the "Go" submit button.

Selenium IDE- Locating Strategies By Identifier
  • Click on the "Run Current Test" button present on the tool bar menu of the IDE. It will execute all of your inserted commands on the browser and gives you an overall summary of the executed test script.
  • The Log pane displays the overall summary of the executed test scripts.

Selenium IDE- Locating Strategies By Identifier

Thus, you can see that we have used identifier locator as a target for most of our Selenium commands.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf