I am examining two potentially different pages for a user name (verifying text is there). Like this:
1:
<div>billgates@starbucks.com</div>
2:
<span>billgates@starbucks.com</span>
I am using Java and selenium. In my java function right now I have my
method( String type, String user)
and then do
`if (type.equals("Vendor") ) {
xpath = "//div[contains(text(),'USERNAME')]".replace("USERNAME", username);
} else {
xpath = "//span[contains(text(),'USERNAME')]".replace("USERNAME", username);
}`
This is fine but I would like to be able to put them together, something like
//(div OR span)[contains(text(),'USERNAME')]".replace("USERNAME", username);
Is there a good way to do this? And yes I can say
`"//div[contains(text(),'" + username + "')]"` (or span)
but that confuses me more opening and closing quotes.