×

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

Related Topics

Selenium WebDriver-Alert Popup

Selenium WebDriver-Alert Popup  An alert popup is one of the small message boxes, which used to give some information to the user that displays on the browser. The Alert popup will be...

6 minutes read.

Name Locator in Selenium IDE

NAME LOCATOR: It is used to find the name in the web element. If we have multiple web elements of the same name, then the first matched element would be returned. Open the...

3 minutes read.

Selenium WebDriver-CSS Selector: Tag Class and Attribute

Selenium WebDriver-CSS Selector: Tag, Class, and Attribute We will locate the web element with the help of Tag, class, and attribute CSS selector locator in this section of the tutorial. Where Tag,...

5 minutes read.

Selenium WebDriver Commands

Selenium WebDriver Commands: As we learn previously in the Selenium-IDE tutorial, Selenium commands are the set of commands that are used to run a Selenium test script. But whereas, Selenium WebDriver had...

2 minutes read.

Selenium WebDriver - Firefox or Gecko (Marionette) browser

Selenium web driver-Firefox or Gecko (Marionette) browser In this tutorial, we are going to learn how to run the Selenium WebDriver test script in the Firefox Browser using the Gecko Driver. Before going...

4 minutes read.

Selenium Wait

In this tutorial, we will understand how we can avoid synchronization issues while executing the test script in a selenium WebDriver. Before going further in this tutorial, first, we will understand that...

10 minutes read.

Selenium-IDE Installation in Mozilla Firefox

A beginners guides to Selenium-IDE Installation Since Selenium IDE is designed only for Firefox and Chrome plug-in, we are assuming that you have already installed the Mozilla Firefox browser in your...

1 minute read.

Selenium-IDE Installation in Chrome

Selenium-IDE Installation Since Selenium IDE is designed only for Firefox and Chrome plug-in, we are assuming that you have already installed the Google Chrome browser in your system. However, you can...

1 minute read.

Operational Controls Methods in Selenium WebDriver

Operational Controls Methods The Operational controls are used to perform all the actions on the web elements like click on the button, pass the value in the text box, and click...

4 minutes read.

WebDriver-Id Locator

WebDriver-Id Locator: The Id Locator is used to identify any web element in UI with the help of the ID attribute. The First preference is always goes to ID locator while inspecting...

4 minutes read.

Selenium WebDriver Tutorial

Seleniun WebDriver Introduction Selenium WebDriver is the essential tool of Selenium Tool Suite because it can directly communicate the browser without any server.  Selenium WebDriver is a browser automation framework that accepts...

3 minutes read.

First test case of Selenium-IDE

First Test Case of Selenium-IDE: In this part, we are discussing how to create a basic test case in Selenium-IDE: The entire test script execution process in Selenium -IDE can be divided...

4 minutes read.

Selenium vs QTP

In this section, we are comparing the most frequently used automation tool –Selenium and QTP. Selenium and QTP have relative advantages over each other- FeaturesSeleniumHP QTPLicensingSelenium is an open-source testing tool....

3 minutes read.

Selenium WebDriver- Microsoft Edge Browser

Selenium WebDriver- Microsoft Edge Browser: In this tutorial, we will learn how to launch the Microsoft Edge browser in the Selenium WebDriver. Before we start automating our test script with Microsoft Edge...

4 minutes read.

Selenium WebDriver-CSS Selector: Tag and Class

Selenium WebDriver-CSS Selector: Tag and Class We will locate the web element with the help of tag and class CSS selector in this section of the tutorials Where Tag and class are...

4 minutes read.

Characteristics of Selenium IDE

Characteristics of Selenium IDE Selenium IDE is separated into different parts, each having their features and functionalities. The seven various components of Selenium IDE are as follows: MENU BAR: The menu bar is...

3 minutes read.

Drag and Drop Event Handling

Drag and Drop Event Handling: In this tutorial, we will learn how to handle the drag and drop event in selenium WebDriver using the action class. Before going further in this tutorial...

6 minutes read.

Mouse and Keyboard Controls in Selenium WebDriver

Mouse and Keyboard Controls in Selenium WebDriver In this tutorial, we will learn about how to handle mouse and keyboard event using action class in selenium WebDriver. Action Class in Selenium WebDriver: Action...

13 minutes read.

WebDriver-Partial Link Text locator

WebDriver-Partial Link Text locator In selenium WebDriver, there is an additional way to find a web link element with the help of partial link text locator. The partial link text is used...

4 minutes read.

Selenium Tutorial

What is Selenium? Selenium is a functional testing tool and compatible with the non-functional testing tools also. Selenium is free and does not require any licensing. Functional tests script executed by...

6 minutes read.