Selenium find exact text using CSS locator

  • 2 Replies
  • 1152 Views
Selenium find exact text using CSS locator
« on: March 09, 2016, 13:45:31 pm »
How would i get an exact match on text using CSS selector ?

For instance if i'd use xPath it would be //p[text()='Lorem ipsum']
« Last Edit: March 10, 2016, 10:30:51 am by Sebastian »

*

Oren

  • **
  • 59
Re: Selenium find exact text using CSS locator
« Reply #1 on: March 10, 2016, 10:32:21 am »
Try these:
Code
css=p[text='Lorem ipsum']
p[innertext='Lorem ipsum']

Re: Selenium find exact text using CSS locator
« Reply #2 on: March 10, 2016, 13:13:30 pm »
Try also
Code
css=p:contains("^Lorem ipsum$") 

 

Sitemap 1 2 3 4 5 6 7 8