Required text() xpath function equal css selector function ?

  • 2 Replies
  • 1316 Views
Required text() xpath function equal css selector function ?
« on: October 04, 2016, 19:33:23 pm »
I have written xpath for input tag. How to write same for the css selector ?

Xpath : //input[text()='Welcome']
css Selector : ??

*

Haim

  • *
  • 10
Re: Required text() xpath function equal css selector function ?
« Reply #1 on: October 05, 2016, 10:18:24 am »
To find the input element with a css selector you could use:

Code
WebElement element = driver.findElement(By.cssSelector("input[text='Welcome']"));

Re: Required text() xpath function equal css selector function ?
« Reply #2 on: October 06, 2016, 02:52:43 am »
Thanks for your reply.  I have tried same type css Selector in firefox browser using firepath add-in but It's not highlighting password element. It's showing no matching node. Why is not highlighting password element ?  Please find attached screenshot.

 

Sitemap 1 2 3 4 5 6 7 8