×

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 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 WebDriver-CSS Selector: Substring Matching

CSS Selector: Substring Matching Selenium WebDriver In this tutorial, we will learn how to identify the web element using the substring method. A Sub-string contains three methods for identifying the web element...

9 minutes read.

Selenium-IDE Locators

Selenium-IDE Locators: Before we start learning about Selenium –IDE Locators, firstly we have to learn about UI elements. UI Elements -UI elements are the elements which are displayed on the web application....

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.

CSS Selector Locator in Selenium IDE

It used to identify the web element based on HTML tag, id, class, and attributes. To describe the look and formatting of a document written in the markup language are known...

1 minute 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.

WebDriver-Name Locator:

WebDriver-Name Locator: The name locator is used to identify any element in UI with the help of the name backend attribute. The Syntax of the name attribute is as below: driver.findElement(By.name(“value of the...

4 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.

CSS Selector: ID/Class and Attribute in Selenium IDE

CSS SELECTOR: ID/Class and Attribute The Id, class, and attribute of CSS selector are used to identify the web element to access the web pages.  Syntax for Id/Class and Attribute: css= <./#> {[attribute=Value of...

2 minutes read.

Selenium-IDE Login test

Login test for Selenium-IDE Now we are learning, how to create a Login/sign-up Test case in Selenium IDE. For our testing purpose, we are going to test the login page provided by...

2 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-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.

Selenium WebDriver - IE [Internet Explorer] browser

Selenium WebDriver - IE [Internet Explorer] browser In this segment, we will understand how to run a test script with the help of the IE (Internet Explorer) browser. It is a standalone...

4 minutes read.

Selenium WebDriver - Browser Controls Commands

Selenium WebDriver - Browser Controls Commands WebDriver includes operations like opening a browser, fetch the title, and closing the browser, etc. Some of the most commonly used Browser controls commands for Selenium WebDriver...

6 minutes read.

Selenium WebDriver-CSS Selector locator

Selenium WebDriver-CSS Selector locator A CSS selector is used to identify the web element based on their “# id” and “. Class”, Html tags, and attributes. A CSS stands for Cascading Style...

1 minute 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.

WebDriver-Link Text locator

WebDriver-Link Text locator The Link text locator is used to identify only web link elements based on the value of the link. The Link text locators cannot be used for other than...

4 minutes read.

Verification Controls Methods in Selenium WebDriver

Verification Controls Methods  The verification controls methods are used to check whether the web element is displayed, enabled, and selected. Some of the most commonly used verification controls are as follow: Verification controls Description Return...

4 minutes read.

Selenium WebDriver &ndash; Web Element Controls

Selenium WebDriver – Web Element Controls A web element is an interface that is implemented by a remote web element class. The Web element control can be used to perform the data...

1 minute 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.