Selenium Tutorial

Selenium Tool Suit Versions of Selenium Selenium Testing Difference Between Selenium and QTP Advantage and Disadvantage of Selenium

Selenium IDE Topics

Selenium-IDE Introduction Installation /download  Selenium–IDE (Firefox) Installation /download Selenium–IDE (Google Chrome) Characteristics of Selenium-IDE First test case of Selenium-IDE Login test for Selenium-IDE Selenium-IDE commands Selenium-IDE locators Id locator Name Locator  X Path Locator CSS Selector Locator Locating by ID Locating by Class Locating by Attribute Locating by ID/Class & Attribute Locating by Sub-string Locating by inner text Link Text Locator Advantage and Disadvantage of Selenium-IDE

Selenium WebDriver Topics

WebDriver introduction Characteristics of WebDriver Difference Between Selenium RC and WebDriver Installation steps of WebDriver WebDriver Class Diagram/ Architecture WebDriver control commands Browser control Navigation control Web element control Operational control Data capture control Verification control WebDriver working with chrome browser WebDriver working with Firefox browser WebDriver working with internet explorer browser WebDriver working with Microsoft Edge browser WebDriver locator Id Locator Name Locator Class name Locator Xpath Locator XPath axes Link text Locator Partial link text Locator Tag name Locator Css Selector Tag and Id Tag and Class Tag and Attribute Tag, class, and Attribute Sub string matches WebDriver wait statements Drop down handling Mouse and keyboard controls Drag and drop Event Handling Window Handling: New tab/new window Alert pop up Handling Checkbox Handling Radio button Handling Selenium Assertion

CSS Selector: Sub String in Selenium IDE

CSS Selector: Sub String

CSS Selector Sub-string is used to match a partial string to locate a particular web element.

  • There are three ways to match a substring using a CSS Selector.
  • Match a prefix
  • Match a suffix
  • Match a substring

Now we will discuss each of them in details with an example,

MATCH A PREFIX:

  • It will access a particular string using a ‘match a prefix’.

Syntax of Prefix:

css= [HTML tag]{[attribute^=prefix of the string]}.

[^]: It is a symbolic notation to match a string using a prefix.

A prefix of the string: matching operation performed based on a string.

  • For example, we will define the CSS Selector for the Email text box of a Facebook login page as css=input#email[name^='em']
CSS SELECTOR SUB STRING
  • Click on the Find button to verify whether the defined CSS Selector locates the desired element or not.
CSS SELECTOR SUB STRING 1

MATCH A SUFFIX:

  • It will access a particular string using a ‘match a suffix’.

Syntax of Suffix:

css= [HTML tag]{[attribute$=suffix of the string]}

     [$]: This is a symbolic notation to match a string using a suffix.

Suffix of the string: matching operation performed based on a string.

  • For example, we will define the CSS Selector for the Email text box of the Facebook login page.

css=input#email[name*='ail']

CSS SELECTOR SUB STRING 2
  • Click on the Find button to verify whether the defined CSS Selector locates the desired element or not.
CSS SELECTOR SUB STRING 3

 MATCH A SUBSTRING:

  • It will access a particular string using a ‘match a substring’.

Syntax of substring:

css=<[attribute*=sub string]>

[*]:It is Symbolic notation to match a string using substring.

Substring: matching operation is performed based on a string

  • For example, we will define the CSS Selector for the Email text box of the Facebook login page as css=input#email[name*='ail']
CSS SELECTOR SUB STRING 4
  • Click on the Find button to verify whether the defined CSS Selector locates the desired element or not.
CSS SELECTOR SUB STRING 5