Skip to content
Advertisement

Extract content with Xpath and data attribute

I need to extract the content of the following div tag which has the data-visible=”1″ attribute and contains the div id “line”.

JavaScript

I tried it like that, but I dont get any result.

JavaScript

What is the right way to extract the content with these both conditions and get the result:

JavaScript

Advertisement

Answer

Since this is a single element you should not use // after //*[contains(@id, "line")]. Also it is a data-visible attribute there, not visible.
You can use XPath expression like this:

JavaScript

Or

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