I am developing some automation tests using webdriver/node/protractor. I am working with the following HTML:HTML
I cannot for the life of me figure out how to either A)identify only the value after the break (Pre-Tax) or define my data comparison xml to account for the break. Here is my xpath: //td/span[contains(text(),'selectedBenefit')]/../../td[8]
I have no problem navigating to the specific text a couple of different ways (node(), text(), etc...) however when I run my test, I get an error saying I need to return an element and not text.
Error > Failed: invalid selector: The result of the xpath expression "//td/span[contains(text(),'Telemedicine - Sequencing')]/../../td[8]/node()[3]" is: [object Text]. It should be an element.
**EDIT: This question has been marked as a duplicate, and I don't think it is, so I am going to explain a little more in detail. The testing framework I am working with compares what is defined in a json file to actual results of the test. So, in the above example, I am expecting the test to return a value of $416.67 Pre-Tax, and that is what I define as the expected result in the json file. The problem is that because the td element that contains this text separates the dollar amount and the tax value (Pre or post Tax) by a break, by using the locator for the td element, the test is only seeing the first value before the break (dollar amount). Now, if I get more granular with the xpath to where I define only the value after the break, I am getting the error that the xpath is objectText, and should be an element. So what I am looking for is a way to either define the break in the json so that the expected and actual values match (tried putting break in the json to no avail), or get the actual result of the test to return ignoring the break in the td element. Sorry if this is explained vaguely, it is quite difficult to convey without writing a novel.