0

I want to feed values to input fields which have no name, no id or no class.

<form class="formclass">
  <input type="text">
  <input type="password">
</form>`
1
  • 2
    To increase the chance of getting help, please include some current code of yours Commented Sep 11, 2016 at 13:07

2 Answers 2

1

Try XPath

//form[@class="formclass"]/input[@type="text"]
//form[@class="formclass"]/input[@type="password"]

or CSS selector

form.formclass input[type="text"]
form.formclass input[type="password"]
Sign up to request clarification or add additional context in comments.

1 Comment

what if we dont know about name of the form class? how can we get nearest identifier of an element(like id or name or class or xpath) to the element(input fields with no identifiers)?
0

Please try the following

xpath:

(//form[@class='formclass]//input)[0] 
(//form[@class='formclass]//input)[1]

css:

.formclass input[type='text']
.formclass input[type='password']

2 Comments

Let us know it works, else will see where it went wrong
Please follow the link for basic's of locator findings seleniummonk.blogspot.in/p/element-locators.html

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.