0

Is there a way to convert these to a CSS selectors?

1) '//form//div[contains(@class,"myclass")]'

2) '//div[contains(@class,"myclass")]//input[@type="submit"]'

3) './/label[(substring(./@for, ((string-length(./@for) - string-length('_state')) + 1)) = '_state')]'

3
  • 2
    Exactly these three? Or you need an general approach? Commented May 28, 2019 at 14:38
  • 1
    ghostinspector.com/docs/css-xpath-conversion this might help. Unless you're looking to automate it. Commented May 28, 2019 at 14:39
  • Exactly these and a general approach for more later. Commented May 28, 2019 at 15:27

1 Answer 1

1

Here are the css for the first 2.

'//form//div[contains(@class,"myclass")]'

form div[class*='myclass']

'//div[contains(@class,"myclass")]//input[@type="submit"]'

div[class*='myclass'] input[type='submit']

'.//label[(substring(./@for, ((string-length(./@for) - string-length('_state')) + 1)) = '_state')]'

label[for $='_state']

Sign up to request clarification or add additional context in comments.

1 Comment

These work. Thank you. And the link above was very helpful too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.