HTMLevents Click Fire Problem

Started by markgolay, July 01, 2016, 03:49:15 AM

Previous topic - Next topic

markgolay

I want to click an Odds button on this betting site IE11 , I can login fine, but cant seem to click anything on the website to add to betslip (if your not login in would bring login screen instead of betslip ) , so just need the code to click any odds button, it uses jquery I think , any ideas or help on this would be very helpful , I think maybe "queryselectorall" or exec a script , but Im not a web developer

;https://www.racebets.com/en/horse-racing/race/details/id/1942281/ ;"Todays Events
   tmp=f.document.getElementsByClassName("m-accWidget__balanceValue ng-binding").item(1)
   if tmp==0
      evt=f.document.createEvent("HTMLevents") ;
      evt.initEvent("change",@TRUE,@TRUE);
      f.document.GetElementByID("m-accWidget--rightBar__inputUsername").value=rblogin
      f.document.GetElementByID("m-accWidget--rightBar__inputUsername").DispatchEvent(evt)
      f.document.GetElementByID("m-accWidget--rightBar__inputPassword").value=rbpwd
      f.document.GetElementByID("m-accWidget--rightBar__inputPassword").DispatchEvent(evt)
      f.document.GetElementByID("m-accWidget--rightBar__btnLogin").click(1)
      Delay(5)
      f=WaitForMSIE(f)
      tmp=f.document.getElementsByClassName("m-accWidget__balanceValue ng-binding").item(1)
   Endif
   custbal=f.document.getElementsByClassName("m-accWidget__balanceValue ng-binding").item(1).innerHTML
   custbal=StrClean(custbal, ".1234567890", "", @FALSE, 2)
   if custbal==0 || custbal=="" ; its null
      Message("Failed","")
   Endif
;------------------------------------
; HERE IS MY PROBLEM BELOW
;------------------------------------

   url="https://www.racebets.com/en/horse-racing/race/details/id/1942281/"
   f.navigate(url)
   evt=f.document.createEvent("HTMLevents") ; does not work
   evt.initEvent("click",@TRUE,@TRUE); ;tried blur,mouseout,keyup,keydown,click, change

   InputCollection = f.document.GetElementsByTagName("A")
   ForEach Input In InputCollection
      name=Input.getAttribute("data-id-runner")
;              <a class="odds-button fixed enabled" data-bet-type="WIN" data-id-runner="18175227"><span>8/1</span></a>
;This changes when you do normal mouse click
;              <a class="odds-button fixed enabled t_hideOnClickOutside" data-bet-type="WIN" data-id-runner="18175227"><span>8/1</span></a>
;      Input.getAttribute("class").value="odds-button fixed enabled t_hideOnClickOutside"
      if name=="18187289"
;         input.focus()
         input.DispatchEvent(evt)
         input.click(1)
         input.FireEvent("onkeydown")
         input.FireEvent("onchange")
;   f.document.parentWindow.execScript("javascript:?????????;", "javascript")   ;Submit
         value=Input.getAttribute("class")
      Endif
   Next

td

Can't say if this is the case here but generally, HTML event problems involve restrictions placed on newer versions of IE COM Automation objects for security reasons and the these problems tend to remain unresolved.    There are several topics on this forum involving HTML events.  You might find reading them instructive.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

Perhaps there is a hidden DIV associated with the click event. You might try running the process through F12 in IE, or the developer tools in Firefox (which are far superior).