How to click an element by innerthtml using CSS selectors in Selenium


Tags: selenium,css-selectors

Problem :

I have HTML code like this

<td>Save</td>

I couldn't locate the element using FireFinder by td:contains("Save")

Is FireFinder wont support the :contains or innerHTML cant be located by :contains?

Read that in Selenium too, :contains wont be supported? However, I couldn't find a documentation for that.



Solution :

That should work in Selenium, I've just tried it myself. Make sure you specify that the locator type is CSS by preceding your locator with css=. Also, the quotes shouldn't be necessary:

css=td:contains(Save)

    CSS Howto..

    How to edit menu in header - wordpress

    How do I prevent a link tag from adding extra padding below an image?

    how to locate an element by value using css selector in webdriver?

    How to select odd child of dl element with css?

    How to showing expanding text with javascript and css

    How can I make a fade in function without using jQuery like this? (JavaScript)

    How do I hide the div if the Var is empty?

    How to create the masonry effects with just bootstrap 3 grid system and css

    How to break a line after some certain width in css

    How to embed SVG styling with javascript?

    CSS - How to make a div's padding not affect the positioning of the div below it

    How to reset jQuery toggled classes applied throughout the page? (AngularProject)

    How to make a graphic image responsive in css

    CSS- how to give an object with scooped corners a border colour?

    Show a box with text when hovering an image

    Symfony2: How to link CSS to HTML part?

    How to properly position a Bootstrap carousel-caption?

    How to optimize an image sequence in Chrome?

    How can I keep my CSS transform (rotate & skew origin) from moving a few pixels to the right?

    How do I make a CSS triangle with smooth edges?

    How to Center Logo in Responsive Header [closed]

    How to Create paragraph first letter uppercase in html & css (in special format)

    How to create a completely flexible piano keyboard with HTML and CSS

    CSS: How to accomplish a div which is blurred at the edges?

    Nine divs in columns. How to design this?

    How to change CSS with jQuery change and this

    Show hint over a CSS background image on mouse over

    How to customize a set of controls with CSS

    How to monitor what the user clicks

    How to display thick line under header of sub menu using css