Well, at least now we have a better picture as to what is going on.
To me, this test scenario is ideally suited to building a dynamic test object “live” during the test case’s execution. The (bad) name attribute is consistent, so therefore I’d build the dynamic TO using just CSS (leave out the rest of that stuff which just causes confusion).
The CSS you need is:
Read this article about modifying properties of TOs:
Then create a dummy TO and modify its “css” property:
def tempTO = WebUI.modifyObjectProperty(findTestObject("dummy"),
"css", "equals", "span[name='CPL413000']", true)
(I typed that out from memory – double check for typos/errors)
I know you can say - “hey Andrew - it runs, so forget about it”.
Unfortunately (or fortunately) - i always attempt to learn better…
No, you’re absolutely right to keep going and not give up. If you shrug and walk away, what would you learn? B)
p.s. I’m surprised the developers are “good enough” to use data-* attributes for custom attributes yet they seem to have no issues with using a name attribute where it doesn’t belong (i.e. in a span). name attributes are typically applied to html form elements (and children) to create name/value pairs for http submission to a server – but spans are not submitted elements.
Furthermore, were you (or anyone) to devise a piece of css/jQuery selector/DOM selector using “[name]” e.g. document.querySelectorAll("[name]") , you’d get all the things you’re expecting (inputs, selects, etc) and a bunch of spans you are certainly not expecting. See? BAD. And like you said earlier, it works, forget about it… nope, I’d be scared that’s going to bite me one day and cost me a ton of time to figure what the hell is going on.
You might mention that to the developers and send them the MDN link. Suggest they use data-email-name, or similar. Thing is, the spec is what it is - a spec. It’s not a secret and it’s not a moving target (unlike bad code!)
End of rant B)