Jump to content

Checking a checkbox that is inside an iFrame


Recommended Posts

Hi guys, I need help as I have worked for more than 18 hours in trying to get this resolved but couldn't. There's a registration page that has an iframe and I need to put a check on the checkbox inside that iframe. The iframe's content is pointing to external source.

 

Could anybody please share a complete simple _IE code to put a check on any of the checkbox in that page so I can analyze it and post my solution here? I am having trouble understanding the syntax of AutoIt. I tried this for hours and couldn't get it to work. The checkbox ID is showing as NOMATCH in AutoIt error report so I thought I had to reference the iFrame first but the iFrame too shows as NOMATCH when they are both sitting there.

Edited by Wolfiesaxah
Link to comment
Share on other sites

  • Moderators

I'll only warn once, this is the 2nd time I've seen that url, if the questions are the same or having to do with the same thing, keep them in one thread.

No bumping within 24 hours of your original post regardless of how anxious you might be.

You have not studied the _IE* functions as I've suggested in that 20 hours, there are few functions to utilize, and all of them have a specific point and easy to see what you must utilize.

All the same, it's simple enough...

#include <IE.au3>


Global $goIE = _IECreate("https://www.hudhomestore.com/Listing/BidderRegistration.aspx?sLanguage=ENGLISH", 1)
If Not IsObj($goIE) Then
    MsgBox(16 + 262144, "Error", "Could not create browser object")
    Exit 1
EndIf

_IELoadWait($goIE)

Global $goFrame = _IEFrameGetObjByName($goIE, "inWin110")
If Not IsObj($goFrame) Then
    MsgBox(16 + 262144, "Error", "inWin110 was not found")
    Exit 2
EndIf

Local $goCheck = _IEGetObjById($goFrame, "chkReceiveSystemEmail")
If Not IsObj($goCheck) Then
    MsgBox(16 + 262144, "Error", "chkReceiveSystemEmail was not found")
    Exit 3
EndIf

; scroll control into view so you can see
$goCheck.scrollIntoView()

If $goCheck.checked Then
    $goCheck.checked = False ; uncheck
    $goCheck.fireEvent("onChange")
    $goCheck.fireEvent("onClick")
    MsgBox(64 + 262144, "Info", "Unchecked checkbox")
Else
    $goCheck.checked = True ; check
    $goCheck.fireEvent("onChange")
    $goCheck.fireEvent("onClick")
    MsgBox(64 + 262144, "Info", "Checked checkbox")
EndIf

But I really hope you're not using IE-11 with the Dec 18 update  :nuke:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...