1

Im trying to get Css selector for this class(below HTML Code) like

1)input[class='js-AddNuts'][type='button'] Selector: CSS
2)input[class='btn js-AddNuts'][type='button']
3)input[class='btn js-AddNuts']

It fails to locate this element

Html Code

<button class="btn js-AddNuts" data-nuts-single-id="1" data-nuts-target-id="SectionIa_AddressContractingBody_Nuts_NutsString" type="button">Add</button>
3
  • Why are you going for cssSelector. if you can simply find the element By.id("SectionIa_AddressContractingBody_Nuts_NutsString")??? Commented Jul 22, 2016 at 13:47
  • this ID is not selenium ID, it was not working. Devs Said thats some data attribute ID Commented Jul 22, 2016 at 13:52
  • ah my mistake...Corrected your question..:) Commented Jul 22, 2016 at 14:26

1 Answer 1

2

You have a button element, not input. Use the dot notation to check a class value:

button.btn.js-AddNuts
button.js-AddNuts
button[class*=AddNuts]
Sign up to request clarification or add additional context in comments.

Comments

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.