TheDeveloperBlog.com

Home | Contact Us

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

Selenium CSS Selector - Sub-string

Selenium CSS Selector - Sub-string 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

CSS Selector - Sub-string

It allows matching a partial string to locate a particular web element.

There are three mechanisms in which matching of a string can be done using a CSS Selector.

  1. Match a prefix
  2. Match a suffix
  3. Match a sub string

We will look at each mechanism in detail with an example.

1. Match a Prefix

  • It allows us to access a particular string using a matching prefix.
  • Syntax : css=<HTML tag><[attribute^=prefix of the string]>
  • ^ - Symbolic notation to match a string using prefix.
  • Prefix of the string - The string based on which match operation is performed.
  • For example, we will define the CSS Selector for the "Password" text box of Test and Quiz login page as: css=input#password[name^='pass']
  • Click on the "Find target in page" button to check whether the defined CSS Selector locates the desired element or not.

Selenium CSS Selector - Sub-string

2. Match a Suffix

  • It allows us to access a particular string using a matching suffix.
  • Syntax: css=<HTML tag><[attribute$=suffix of the string]>
  • $ - Symbolic notation to match a string using suffix.
  • Suffix of the string - The string based on which match operation is performed.
  • For example, we will define the CSS Selector for the "Password" text box of Test and Quiz login page as: css=input#password[name$='ord']
  • Click on the "Find target in page" button to check whether the defined CSS Selector locates the desired element or not.

Selenium CSS Selector - Sub-string

3. Match a sub string

  • It allows us to access a particular string using a matching sub string.
  • Syntax: css=<HTML tag><[attribute*=sub string]>
  • * - Symbolic notation to match a string using sub string.
  • Sub string - The string based on which match operation is performed.
  • For example, we will define the CSS Selector for the "Password" text box of Test and Quiz login page as: css=input#password[name*='word']
  • Click on the "Find target in page" button to check whether the defined CSS Selector locates the desired element or not.

Selenium CSS Selector - Sub-string



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