TheDeveloperBlog.com

Home | Contact Us

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

WebDriver Locating Strategies By XPath Using Single Slash

WebDriver Locating Strategies By XPath Using Single Slash 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 WEBDRIVER

Locating Strategies- (By XPath- Using Single Slash)

In this section, you will learn how to locate a particular web element by XPath- Using Single Slash.

Single Slash mechanism is also known as finding elements using Absolute XPath. Single Slash is used to create XPath with absolute XPath i.e. the XPath would be created to start selection from the document node/ Start node/ Parent node.

Note: XPath Absolute is not recommended because it takes the complete XPath location and if the location of the web element is changed or it belongs to some other parent then XPath will be unable to locate the desired element.

The syntax for locating elements through XPath Absolute is written as:

//html/body/tag1[index]/tag2[index]/.../tagN[index]

Using Single Slash/Absolute XPath, we can write the Java code along with the dynamic XPath location as:

findElement(By.xpath("html/body/div[1]/div[2]/div[2]/div[1]/form/div[1]/div/div[1]/div/div/input[1]"));





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