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 DOM

Selenium IDE- Locating Strategies By DOM 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 DOM)

DOM stands for Document Object Model. In simple words, DOM specifies the structural representation of HTML elements.

There are four ways through which we can identify and locate a web element using DOM.

  1. getElementById
  2. getElementsByName
  3. dom:name (applies only to elements within a named form)
  4. dom:index

1.getElementByID

  • Syntax: document.getElementById("id of the element")
  • Id of the element - It is the value of the Id attribute which is beig accessed.
  • For example, we will define the DOM value for the "Username" text box of Test and Quiz login page as: document.getElementById("email")

2.getElementsByName

  • Syntax:document.getElementByName("name")[index] Name - It is the value of name attribute which is being accessed.
  • Index - An integer value used to specify the location of the desired element.
  • For example, we will define the DOM value for the "Username" text box of Test and Quiz login page as: document.getElementByName("email_id")

3.dom:name

  • Syntax : document.forms["name of the form"].elements["name of the element"]
  • Name of the form - It is the value of the name attribute of the form tag that contains the element you want to access.
  • Name of the element - It is the value of the name attribute of the element you want to access.
  • Example: "document.forms["home"].elements["userName"]"

4.dom:index

  • Syntax : document.forms[index of the form].elements[index of the element]
  • Index of the form - The integer value of the index (starting at 0) of the form with respect to the whole page.
  • Index of the element - The integer value of the index (starting at 0) of the form with respect to the whole form that contains it.




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