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 AND

WebDriver Locating Strategies By XPath Using AND 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 And)

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

Let us consider an example in which we will try to locate the Google Search Engine Text box by XPath- Using And.

Follow the steps given below to locate the textbox provided on the home page of Google Search Engine.

  • Open URL: https://www.google.co.in/ in your Firefox browser
  • Right click on the Textbox on the sample web page and select Inspect Element
Locating Strategies- By XPath- Using And
  • It will launch a window containing all the specific codes involved in the development of the textbox.
Locating Strategies- By XPath- Using And
  • Take a note of its id and Class Attribute.
Locating Strategies- By XPath- Using And

The syntax for locating elements through XPath- Using And can be written as:

//<HTML tag>[@attribute_name1='attribute_value1' and @attribute_name2='attribute_value2]

or

//*[@attribute_name1='attribute_value1' and @attribute_name2='attribute_value2]

Using XPath-And, we can write the Java code along with the dynamic XPath location as:

findElement(By.xpath("//*[@id='lst-ib' and @class='gsfi lst-d-f']"));





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