I’m using playwright for testing web pages. When I use id tag as locator, I can find direct children of tagged div:
<code>page.locator('#id_tag > div').all()
</code>
<code>page.locator('#id_tag > div').all()
</code>
page.locator('#id_tag > div').all()
Now I try to use test_id tag and I need to find direct children:
<code>page.get_by_test_id("test_id_tag").locator("div").all()
</code>
<code>page.get_by_test_id("test_id_tag").locator("div").all()
</code>
page.get_by_test_id("test_id_tag").locator("div").all()
But this is equivalent to:
<code>locator('#test_id_tag >> div')
</code>
<code>locator('#test_id_tag >> div')
</code>
locator('#test_id_tag >> div')
So Playwright returns direct children, but also sub-children, sub-sub-children, etc.
Is there any way to find only direct child elements using get_by_test_id("test_id_tag")
?