Searching for the element with   symbol in selenium


Below is the Example

HTML automatically normalizes whitespace within elements, ignoring leading/trailing spaces and converting extra spaces, tabs and newlines into a single space.
If element is not found because   what you need to do is Eliminates redundant spaces from the supplied string for that you should use normalize-space function.
Normalize-space: The normalize-space function strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string.
How to frame Xpath is
WebElement lblEle=driver.findElement(By.xpath("//label[normalize-space(translate(., '\u00A0', ' '))='Plan to Ship Response ID']/../div[@class='value']"));
System.out.println(lblEle.getText());

Comments