Using Excel VBA Trim function with xpath in selenium

Using Excel VBA Trim function with xpath in selenium.

Abstract = "//textarea[@id='ctl00_MainContent_ArticleTabPages_txtAbstract'][contains(text(),'" & Trim(Cells(r, 4)) & "')]"

The text in the excel cell had a space at the end of the string and
this was causing the scripts to fail as the string did not match with
the text on the webpage. I then used the trim function to remove the
space at the begining and end of the string.

Print #FileNum, "<tr>"
Print #FileNum, "<td>verifyElementPresent</td>"
Print #FileNum, "<td>"; Abstract; "</td>"
Print #FileNum, "<td></td>"

Print #FileNum, "</tr>"

Leave a Reply

Your email address will not be published. Required fields are marked *