Hi !
Open IE as an Activex and load a page with a map. I need to simulate a click on this page at the point where the mouse cursor is. How can I do that ?
Natter wrote:Thanks. I usually just used a DOM
Natter wrote:Hi, Mr. Horizon
Create Activex object and open website
oAx:Do("Navigate", myURL)
Any page of the website is a Document.
oDc:=oAx:GetProp("Document")
All we see on the page are the elements of the document (buttons, forms, etc.).
There was a map element on my page. I got this element method of a DOM
el:=oDc:getElementById("map")
Using other DOM methods, you can perform various manipulations on the element
PROCEDURE Web_Deneme()
Local IE, WshShell
IE := CreateObject("InternetExplorer.Application")
WshShell := CreateObject("WScript.Shell")
IE:Visible := .t.
IE:Navigate( "https://vatandas.uyap.gov.tr/main/vatandas/giris.jsp" )
Do While IE:Busy
SysWait(1)
SysRefresh() // To Refresh
Loop
Enddo
Button := ie:document:getElementsByClassName("a.btn.red-flamingo")
TRY
Button[0]:click()
SysReFresh()
CATCH
Msginfo("Could not find DOM element 'button'")
// IE:Quit()
return(nil)
END
RETURN
Natter wrote:The searched element may not have an identifier, name, type. In this case, there is a unique class -"btn red-flamingo"
getElementsByClassName()
Button := ie:document:getElementsByClassName("btn red-flamingo")
TRY
Button:click()
SysReFresh()
CATCH
Msginfo("Could not find DOM element 'ilk giriş'")
// IE:Quit()
return(nil)
END
Natter wrote:Try so
oEvt:=button:createEventObject()
oEvt:type:="click"
button:fireEvent("onclick", oEvt)
Button := ie:document:getElementsByClassName("btn red-flamingo")
Error description: (DOS Error -2147352570) WINOLE/1009 No exported method: CREATEEVENTOBJECT
Stack Calls
===========
Called from: => TOLEAUTO:CREATEEVENTOBJECT( 0 )
Called from: .\ICRA_LBT.prg => WEB_DENEME( 722 )
Button := ie:document:getElementsByClassName("btn red-flamingo")
Button:click()
Error description: (DOS Error -2147352570) WINOLE/1009 No exported method: CLICK
Stack Calls
===========
Called from: => TOLEAUTO:CLICK( 0 )
Called from: .\ICRA_LBT.prg => WEB_DENEME( 727 )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 95 guests