Your xpath syntax is wrong - you don't need the inner set of square brackets - but even if you fix this:
//button[@type, 'submit' and text()='New']
it won't select what you want it to. The problem is that the "New" is not text contained directly in the button element but is inside a child span element. If instead of text()
you just use .
then you can check the whole string value of the element (the concatenation of all descendant text nodes at whatever level)
//button[@type='submit' and contains(., 'New')]
Or check span
instead of text()
:
//button[@type='submit' and span='New']
(submit buttons containing a span whose value is "New")