-1

I am trying to work on an xpath for a pdf text.here is what I have

 cell(:x, :xpath => "//table//td[contains(.,'pdf')]")

what I am looking for is the proper way to make the 'pdf' non-case sensitive so it can be 'pdf' or 'PDF'

Here is what I've tried

cell(:commission_statement, :xpath => "//table//td[contains(.,'pdf'|'PDF')]")
Matt Westlake
  • 3,499
  • 7
  • 39
  • 80

2 Answers2

1

Try :xpath => "//table/td[contains(.,'pdf') or contains(.,'PDF')]".

Wally Altman
  • 3,535
  • 3
  • 25
  • 33
1

You can use this xpath:

"//table//td[contains(.,'pdf')] | //table//td[contains(.,'PDF')]"

alternative solution:

"//td[contains(translate(., 'PDF', 'pdf'), 'pdf')]"

what translate does:
translate(string1,string2,string3)

Converts string1 by replacing the characters in string2 with the characters in string3
Example: translate('12:30','30','45') Result: '12:45'

Example: translate('12:30','03','54') Result: '12:45'

Example: translate('12:30','0123','abcd') Result: 'bc:da'

Nora
  • 1,432
  • 8
  • 9