0

What will be the Selenese for this element?

<input type="text" value="0" id="28" name="UNDER PRIVILEDGED" class="textbox"> 

I've written like this

cmd    : type
Target : name=UNDER PRIVILEDGED
Value  :7000

But found this error -

[error] Element name=UNDER PRIVILEDGED not found.

There is a space in the name.

1 Answer 1

1

I think a space in the name attribute is not valid.

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

http://www.w3.org/TR/html401/types.html#type-name

So I assume Selenium do not handle invalid HTML.

3
  • 1
    IMHO Selenium should not try to handle invalid HTML. In Python, we have a zen rule about that: "In face of ambiguity, refuse temptation to guess". Because chances are, your guess will be wrong, and your code will just get stuck again, but deeper in the rabbit hole. Commented Aug 5, 2014 at 11:41
  • @PeterMasiar I totally agree with you. I think it is totally on purpose that Selenium do not handle that. One argument is, that Selenium test from the users point of view and you can not get the text of invisible elements. But this is just an example.
    – Twaldigas
    Commented Aug 5, 2014 at 11:48
  • I totally agree with you too. So we are in violent agreement. After so many years naming things in programming, I would never even consider to use space in the name of anything. I even shudder when I have to deal with space in file names (created by other people, not me). Commented Aug 5, 2014 at 12:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.