Let us know your feature requests - also vote for others.

Please add an option/axis to identify element(s) without children elements

In certain cases, it would be useful to have an option to identify an element, which contains NO children elements.

Please try the below HTML sample here:
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_div_test

<!DOCTYPE html>
<html>
<body>

<div style="color:#0000FF">
<p>Text_1</p>
</div>
<div style="color:#0000FF">
</div>
<div style="color:#FF00FF">
<p>Text_3</p>
</div>

</body>
</html>

Let's say I need to identify a DIV tag, which is a sibling of DIV tag with string Text_1, but only if the DIV tag contains no children elements. I'f I'm not mistaken, there is currently no way do it with the xpath?

Here is the best xpath I was able to create:
/dom[@caption='Tryit Editor v3.5']/?/?/div[@id='container']/div[@id='iframecontainer']/?/?/div[@id='iframewrapper']/iframe[@id='iframeResult']//p[@innertext='Text_1']/ancestor::div/following-sibling::div[@visible='True']

It returns two DIVs, but I need to identify the one WITHOUT P element. It's easy to identify the one WITH P tag, but there is no way to identify the one without (using xpath) ;)

1 vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Pavel Kudrys shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base