I am converting my project element library from xpath to CSS. Some xpath expression written using 'following' and 'preceding' method. Like below.
//div[@id='dashboard_right_now']/following::a[contains(@href, 'edit')][text() = 'Posts']
Now I want to convert same expression with equivalent CSS. I searched google around and found "+" operator used as 'following' in CSS. But firepath tools gives "no node matched" error.
div#dashboard_right_now>div.inside>div>p + a[href*='edit']
Any suggestion on how to incorporate 'following' and 'preceding' methods in css selector. Thanks
1 Answer 1
Please consider the following advice:
preceding:
- css selector currently does not support traverse backwards, it may be supported in the future.
following:
- Element E1 following some sibling E2,
css = E2+E1
- Element E1 following sibling E2 with one element in between,
css = E2+ * + E1
- Some element immediately following E,
css = E + *
Explore related questions
See similar questions with these tags.
preceding
in css. On another note, expression looks very long and prone to errors when application changes.