GET all DIV + CORRESPONDING P TAGS + HTML Page

Hi all,

I need to get the DIV and corresponding P tags in a page. Once I find the DIV tag text I need to extract the text from the P tag after it.

Can someone help me with this ?

had you tried find children Activity so far?

Yes, I am using find children with this filter webctrl tag=‘div’/. But this gives me only div tag items. I am searching for the key word in those DIV tag items. I need to get the “p tag” items immediately after the div tag item text

it would be better to share structure details with us. Give a try on

Find children - output: childrens

For each Activity | item in childrens | TypeArgument: UiElement

  • log message:
item.FindFirst(FindScope.Find_Descendants, new Selector("<webctrl tag='p' />"),nothing).Get("innertext").toString.Trim

Keep in mind: with more element sctructure details, we can maybe go also for another option

Here is the structure.

For example on this page with Find children using DIV tag I can find “Heading”.

After I find that I need to get the P tag values after it.

Here is the structure

UPD1 - will work when div is parent to p elements

This is the error message I see. When I used that

show all modelling details




we updated above - as div is not parent to the p elements, so we get no p elements

in such a scenario it might be an option to model it as an series parser and

  • react on div
  • react on p

Can you give me XAML file code how to do this ?

just give us the sample html as text file and we will work against this demo data

New Text Document.txt (1.6 KB)
@ppr

we would recommend to do some more detail checks and fine tuning

Have a flow like this:


With find children details:
grafik

"<webctrl  css-selector='div.heading4 , div.heading4 ~ p'  />"

And a target set to a reliable parent element to the div / p elements

would receive a series like this (refering to the logs:)

"Process: " & xe.Get("tag").toString
"Process: " & xe.Get("text").toString

And it could be used for post processings e.g. div and corresponding p segmentation

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.