Your post above contains strange strings: //span[@target'], //span[@target has-error'].
I suppose those are not what you intended to present to us.
This Forum has a problem in processing a text containing @. You need to make a bit of efforts in typing a xpath string with @ in this Forum. But how? — I will tell it to you.
When you open editting mode in this Forum, you can find a button </> as this.
If you click this “HTML-mode button”, the textarea changes from WYSIWG mode to HTML mode. In the HTML mode, please type xpath string enclosing with and . as follows:
...I have a object which is a edit field with validation, called by xpath: <code>//span[@target='foo'] </code> - this is for filled field...
By enclosing a xpath with @name with and , you can present the xpath in this forum as you see in the raw code.
Omg thats something, now you imagine you have 24 objects and not only one. You will end up with a long code. So probably easier would be create two separate object and after event look for the one with the different xpath. In this case I would end up with a long objects repository, so I have to choose then. Thank you