Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetHtmlElements: 2 pop-ups appearing, taking focus away from firefox
#4
Sorry one more question.

Using your example I was able to extract all divs which have a classname that begins with "row\s" (regx, 'row' followed by a space).

Macro Macro101
Code:
Copy      Help
int w=wait(3 WV win("Mozilla Firefox" "MozillaWindowClass"))
FFNode doc.FromDoc(w)
doc.FindFF(doc "div" "" "class=^row\s" 8 0 0 &sub.Callback_FindFF)

Then in the subfunction I used

Macro Macro101
Code:
Copy      Help
Acc k.FromFFNode(x 1)
str tag innerHTML outerHTML
k.WebProp(tag innerHTML outerHTML)


It results in multiple HTML blocks beeing extracted:

 
Code:
Copy      Help
<DIV class=icn>
    <A class=fulllink href="https://www.TEST.com/" target=_blank>
    <IMG src="https://thumb.png"> <================================================= get  'https://thumb.png'
    </A>
</DIV>
<DIV class=gameinfo>
    <DIV class=title>
        <A href="https://TEST.com/" target=_blank>some title</A> <================================================= get   'some title'  (inner text)
        <DIV class=js-subproduct-admin-edit data-machine-name="qm_studio" data-entity-kind="subproduct"></DIV>
    </DIV>
    <DIV class=subtitle>
        <A href="https://www.syntystudios.com/" target=_blank>QM Studios</A>
    </DIV>
</DIV>


QUESTION:

1)
What is the best method to extract:
https://thumb.png
FROM:  div class = "icn"
EXTRACT: IMG src
(I marked it above in the code with arrow:   <==============   )

2)
What is the best method to extract:
some title
FROM:  div class = "title" ,
EXTRACT: the innertext from the   <A href'   which is  within   div class = "title"
(I marked it above in the code with arrow:   <==============   )

What I would attempt to use is

Macro Macro101
Code:
Copy      Help
int i
HtmlDoc d.InitFromText(outerHTML)
ARRAY(MSHTML.IHTMLElement) extract_el_arr
d.GetHtmlElements(extract_el_arr "A" "")
for i 0 extract_el_arr.len
,_s=extract_el_arr[i].className
,if(_s=....)
,,....


But I do not know what best approach / proper approach is.
Maybe I am using incorrect / cpu resource waisting method (?)


Messages In This Thread
RE: GetHtmlElements: 2 pop-ups appearing, taking focus away from firefox - by r0n - 05-20-2020, 11:49 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)