Skip to content
Advertisement

Selenium – Find element at other element level

I have following piece of code to read value from one field:

JavaScript

In this case I receive an empty string.

If I do it in this way with long xpath it reads correct value:

JavaScript

So my question is why using findElement at WebElement row doesn’t work.

I’d like to do it this way because I need to read more values from specific row elements so it would be better to have possibility to separate needed row first.

Advertisement

Answer

In order to find element inside element with XPath locator the XPath locator should start with a dot ..
So, in order to locate a cell inside a row with

JavaScript

please try defining the nbrCellXpath XPath expression as

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement