Jump to content

frame and form in https


Recommended Posts

I'm trying to create a script to log in a https page. in this page there are 2 frame.

I downloaded the debugbar and i found the name of the form i need but the script doesn't work.

this is my code

CODE
#include <IE.au3>

$oIE = _IECreate ("http://www.xxxx.it/",0,1,1,1)

$oFrame = _IEframegetobjbyname($oIE,"f2")

$oForm = _ieformgetobjbyname($oFrame,"login")

$o_login= _ieformelementgetobjbyname($oForm,"LOGIN")

$o_password=_ieformelementgetobjbyname($oForm,"PASSWD")

_IEFormElementSetValue ($o_login, "12345768")

_IEFormElementSetValue ($o_password, "abcdefgh")

and this is the error i have

CODE
>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\superman\Desktop\logfin.au3"

C:\Program Files\AutoIt3\Include\IE.au3 (1247) : ==> The requested action with this object has failed.:

$o_col = $o_object.document.forms.item($s_Name)

$o_col = $o_object.document^ ERROR

>Exit code: 1 Time: 9.944

is there someone who can help me to understand where i'm wrong?

thankyou in advance

Edited by scooper
Link to comment
Share on other sites

Add the following line before _IECreate and see what errors are written to the console.

_IEErrorHandlerRegister()
thank you for the answer big_daddy

this is the error,

CODE
"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\superman\Desktop\logfin.au3"

--> COM Error Encountered in logfin.au3

----> $IEComErrorScriptline = 1247

----> $IEComErrorNumberHex = 80020009

----> $IEComErrorNumber = -2147352567

----> $IEComErrorWinDescription = Accesso negato.

----> $IEComErrorDescription = Accesso negato.

----> $IEComErrorSource =

----> $IEComErrorHelpFile = C:\Windows\system32\mshtml.hlp

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

--> COM Error Encountered in logfin.au3

----> $IEComErrorScriptline = 1262

----> $IEComErrorNumberHex = 80020009

----> $IEComErrorNumber = -2147352567

----> $IEComErrorWinDescription = Accesso negato.

----> $IEComErrorDescription = Accesso negato.

----> $IEComErrorSource =

----> $IEComErrorHelpFile = C:\Windows\system32\mshtml.hlp

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

--> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

>Exit code: 0 Time: 9.320

i'm sorry but i don't understand what i have to change,

this is my first time with a frame site

Link to comment
Share on other sites

  • Moderators

You are encountering a cross-site scripting error. In short the domain used within the frame is different than the parent page domain. Try navigating directly to the url of the frame and attempt to automate it that way.

Link to comment
Share on other sites

You are encountering a cross-site scripting error. In short the domain used within the frame is different than the parent page domain. Try navigating directly to the url of the frame and attempt to automate it that way.

You are Great.... :):party:

it works now..

Thankyou very much

I hope a day a could help you as you made with me

bye

Link to comment
Share on other sites

as asked me by Jon8763 this is my work code.

CODE
#include <IE.au3>

$oIE = _IECreate ("www.xxxx.it,1,1,1,1)

$oForm = _ieformgetobjbyname($oIE,"login")

$o_login= _ieformelementgetobjbyname($oForm,"LOGIN")

$o_password=_ieformelementgetobjbyname($oForm,"PASSWD")

_IEFormElementSetValue ($o_login, "12345678")

_IEFormElementSetValue ($o_password, "abcdefgh")

$oSubmit = _IEGetObjByName ($oIE, "btn_login")

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

first thing to do as told big_daddy is to find the correct url. you can find it in HTML code.

Link to comment
Share on other sites

  • 2 years later...

I am facing a problem with Frames. When I create the IE object I cannot get any objects inside the program. This page uses frames, but your browser doesn't support them. I am using IE8.. I dont understand the problem.

What I am trying to do is automate logging in to this website https://www.acgme.org/residentdatacollection/.

Is there anyway I can use Autoit for this?

#include <IE.au3>
;.fo
; Create a browser window and navigate to hotmail
$sUrl = "https://www.acgme.org/residentdatacollection/"

$oIE = _IEAttach($sUrl, "url")
If not isObj($oIE) Then
    $oIE = _IECreate()
    _IENavigate($oIE, $sUrl)
EndIf

$source = _IEBodyReadHTML($oIE)
ConsoleWrite($source)

; get pointers to the login form and username and password fields
$o_form = _IEFormElementGetObjByName($oIE, "loginentry")
$o_login = _IEFormElementGetObjByName($o_form, "USERID")
$o_password = _IEFormElementGetObjByName($o_form, "PASSW")



; Set field values and submit the form
_IEFormElementSetValue($o_login, "1234")
_IEFormElementSetValue($o_password, "abcd")
_IEFormSubmit($o_form)


Exit

And I get the following Console feed back

<FRAME frameSpacing=0 marginHeight=0 src="empty.html" frameBorder=1 name=dbaccess marginWidth=0 scrolling=0><FRAME src="login.asp" name=display><NOFRAMES></NOFRAMES>--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType
--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...