TestProject Forum
Powered by leading experts in the test automation community

Required text() xpath function equal css selector function?

I have written xpath for input tag. How to write same for the css selector ?

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

To find the input element with a css selector you could use:

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

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.