823g4n8901
823g4n8901

Reputation: 139

Xpath equals OR contains text

I'm trying to do an or between = and contains. I know how to do or between multiple contains but not multiple equals. I want to do something like this but it's not working:

xpath=//*[text()[="HOA fees" or [contains(.,"HOA fee:")]]]/following-sibling::*

Upvotes: 1

Views: 3761

Answers (1)

kjhughes
kjhughes

Reputation: 111726

To fix your syntax problem, change

//*[text()[="HOA fees" or [contains(.,"HOA fee:")]]]/following-sibling::*

to

//*[text()[.="HOA fees" or contains(.,"HOA fee:")]]/following-sibling::*

This will select all sibling elements following all elements with a text node child that equals HOA fees or has a HOA fee: substring. If that's not exactly what you had in mind, follow-up in comments to clarify your actual goal.

See also:

Upvotes: 1

Related Questions