0

I use the following X-path to extract a web element based on the starts-with condition

//a[starts-with(@href,'https://test-abc-eu.softcore.com')]

I want to increase the scope of the search by adding a logical OR condition to the search. Anything that starts with

//a[starts-with(@href,'https://test-abc-eu.softcore.com')]
//a[starts-with(@href,'https://test-abc.softcore.com')]

Something like

//a[starts-with(@href,'https://test-abc-eu.softcore.com' or @href,'https://test-abc.softcore.com')]

Is this possible? Any help would be appreciated. Thanks.

jack ryan
  • 61
  • 7
  • Because your requirements are similar, would you mind looking at the answer to this question and see if it addresses your problem? https://stackoverflow.com/questions/21405267/xpath-using-regex-in-contains-function – WGS Aug 10 '19 at 11:02

1 Answers1

1

The correct syntax would be:

//a[starts-with(@href,'http://test-abc.softcore.com') or starts-with(@href,'https://test-abc-eu.softcore.com')]

Demo:

enter image description here

As you can see both links are matched.

References:

JeffC
  • 22,180
  • 5
  • 32
  • 55
Dmitri T
  • 159,985
  • 5
  • 83
  • 133