Find element child

Ask general questions here.
[email protected]@
Posts: 18
Joined: Fri Dec 27, 2019 12:16 pm

Find element child

Post by [email protected]@ » Tue Mar 03, 2020 5:53 am

I has a issue following :
xpath A ="//li"
How to find element child btag of xpath A?
I used method itemAdapter.FindChild<Btag>() but it isn't work?
Can you help me?

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6036
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Find element child

Post by odklizec » Tue Mar 03, 2020 9:32 am


Could you please upload a Ranorex snapshot (NOT screenshot) of the Li element you are trying to get the "B" from? Also, what exactly is not working? Is there an error message reported?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Certified Professional
Certified Professional
Posts: 215
Joined: Mon Jul 11, 2016 2:15 pm

Re: Find element child

Post by Vega » Tue Mar 03, 2020 5:37 pm

Given the below example:

Code: Select all

<!DOCTYPE html>

<h1>The b element</h1>

<a>This is normal text - <b>and this is bold text</b>.</a>

Your path to the A tag might look like this:

Code: Select all

/dom[@domain='']//a[@innertext='This is normal text - .']
And the path to the first child B tag would look like this (add '/b' on to the end):

Code: Select all

/dom[@domain='']//a[@innertext='This is normal text - .']/b
This is a very basic example and is just returning the first child b tag of the a tag. You could of course use more attributes or indexes for the B tag if needed.

Hope this helps