WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: markgolay on March 16, 2014, 07:04:11 AM

Title: IE11 fireevent Problem tried everything for many Hours
Post by: markgolay on March 16, 2014, 07:04:11 AM
; Please help I have a small program that's works on IE8 with Betvictor,
; I want to move it to IE11 but have been getting lost of issues,
; but main problem at the moment is unable to fireevent("onkeyup")
; the code below is working example, if you run this it does not update the total stake
; but if you click in the stake field & press the keyup it works, I have this running in bigger program that works on IE8
;
; I hope you can help, I have spent many hours trying different things & I cant get it to work at all.
; Hope I get some fresh Ideas 


#DefineFunction WaitForMSIE(Browser)
   While Browser.Busy || Browser.ReadyState <> 4
     TimeDelay(0.5)
   EndWhile
   Return Browser
#EndFunction

bmid="http://www.betvictor.com/sports/en/cricket/tournament-outrights/coupons/17500/210561010/465675400/0/0/PE/0/0/0/0/0"
f = ObjectOpen("InternetExplorer.Application")
f.Visible = @TRUE

f.Navigate(bmid)
f=WaitForMSIE(f)
whitem="18201960500"

; f.document.GetElementByID("remove_all").click(1) ; does not work even with HTMLevents
mycnt=0
  InputCollection = f.document.GetElementsByTagName("A")
  mycnt=0
  ForEach Input In InputCollection
   name=Input.innerText
   if name=="Remove All"
    Input.click(1)
    break
   Endif
  Next

yield
;return Betslip.add(18972819000)
InputCollection = f.document.GetElementsByTagName("A")
mycnt=0
ForEach Input In InputCollection
  name=Input.getAttribute("id")
  n2=Input.getAttribute("onclick")
  if strindexnc( name, whitem, 1, @Fwdscan ) >0

   Input.click(1)
   break
  Endif
Next

; f.document.GetElementByID(whitem).click(1)
f=WaitForMSIE(f)


; Help Here I cant get the stake to to do the onkeyup to trigger jquery stuff in the page works on Old IE8

InputCollection = f.document.GetElementsByTagName("INPUT")
mycnt=0
ForEach Input In InputCollection
  name=Input.getAttribute("name")
  if strindexnc( name, "stake", 1, @Fwdscan ) >0
;   Delay(10)
   Input.value="2.00"
   Input.FireEvent("onkeyup"); works on old IE
   objevent=f.document.createEvent("htmlevents") ; does not work
   objevent.initEvent("onkeyup",@TRUE,@TRUE);
   Input.dispatchEvent(objevent);
   break
  Endif
Next
Title: Re: IE11 fireevent Problem tried everything for many Hours
Post by: stanl on March 16, 2014, 09:07:59 AM
Perhaps a compatibility setting issue.
Title: Re: IE11 fireevent Problem tried everything for many Hours
Post by: markgolay on March 17, 2014, 04:16:00 AM
Just found a temporary fix , I can click Eachway Box on/off, this then forces the update/change fireevent, but would still like to find the proper answer for doing on the stake name

   ; Force Focus and change on the element as cant do it on the stake
   InputCollection = f.document.GetElementsByTagName("INPUT")
   mycnt=0
   ForEach Input In InputCollection
      name=Input.getAttribute("name")
      if strindexnc( name, "ew", 1, @Fwdscan ) >0
         Input.click(1)
         Delay(0.5)
         Input.click(1)
         break
      Endif
   Next