Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htm comand to find links
#1
Hi,

I need QM to find and click several links on a web page, the links start all with the same string of chars like "DeflautLink" then some other text follows.

I`d like QM to find text "DeflautLink" click it then find this text again below click it and again...

How do i do it? Do i have to use htm command or just find text, get mouse pointer and click those coordinates?

Thanks,
#2
Usually when you click a link you get new page. If these links don't open a new page, can be used this code:

Code:
Copy      Help
Htm el=htm("BODY" "" "" "+IEFrame" 0 0 0x20) ;;get BODY element which is container for all visible elements
MSHTML.IHTMLElement2 el2=+el.el ;;get IHTMLElement2 interface because we need getElementsByTagName function
MSHTML.IHTMLElement el3
foreach el3 el2.getElementsByTagName("A") ;;enumerate hyperlinks and anchors
,str linktext=el3.innerText ;;get link text
,if(!linktext.len) continue
,out linktext ;;remove this
,if(linktext.beg("DeflautLink"))
,,el3.click

Similar code also can be used to check all checkboxes.
#3
I have a similar problem: I need to find all of the links in a web page that have a certain string in the page that they would bring up if I pushed them. I don't actually need to click the links, just to find out what page they would bring up if I did push them.

I couldn't make Gintaras' code work. I get an "unexpected identifier" error at this line:

MSHTML IHTMLElement2 el2=+el.el

What should I do?
#4
Oops, never mind. I didn't see the dot after "MSHTML" and it makes much more sense with the dot.

I guess my eyes are going, but my brain is still OK.
#5
maybe it's the 'coding at midnight'? :wink:
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)