Abiarch Posted June 18, 2015 Posted June 18, 2015 Hi,I am trying to use the _IE functions.I am able to use the _IECreate function which will load the html page which we have generated. But when I am trying to use_IEGetObjByName function the return value shows 0 which is an error.Same with the result of _IEFormGetObjByName function. My script is only opening the html page. It is not performing any other functions.Also to mention I am including #include <IE.au3> header.Could someone please help me with this? Thanks.
Moderators Melba23 Posted June 18, 2015 Moderators Posted June 18, 2015 Abiarch,Welcome to the AutoIt forum.But please pay attention to where you post - the "Dev Chat" section where you started this thread is not for general support questions. I have moved it for you, but would ask you to be more careful in future.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Abiarch Posted June 18, 2015 Author Posted June 18, 2015 Below is the code snippet I am talking about. I am new to autoIT. #include <IE.au3>Local $Link = "D:\path\Example.html"Local $oIE = _IECreate($Link)Sleep(2000)Local $oForm = _IEFormGetObjByName ($oIE, "test123") Sleep(2000)Local $oSubmit = _IEGetObjByName($oForm, "submitExample")_IEAction($oSubmit, "click")_IELoadWait($oIE) I tried printing the return value for _IEFormGetObjByName and _IEGetObjByName. It prints 0.
Danp2 Posted June 18, 2015 Posted June 18, 2015 You need to check the value of @error following each _IE function call. Latest Webdriver UDF Release Webdriver Wiki FAQs
Abiarch Posted June 19, 2015 Author Posted June 19, 2015 Hi,Thanks Danp2 for your response. I tried getting value of @error. The value is 0. Which probably means no error.Is anything missing in the code snippet I have posted below? I cant see any other operation while running the script other than opening of the html page.Below is the code snippet I am talking about. I am new to autoIT. #include <IE.au3>Local $Link = "D:\path\Example.html"Local $oIE = _IECreate($Link)Sleep(2000)Local $oForm = _IEFormGetObjByName ($oIE, "test123") Sleep(2000)Local $oSubmit = _IEGetObjByName($oForm, "submitExample")_IEAction($oSubmit, "click")_IELoadWait($oIE) I tried printing the return value for _IEFormGetObjByName and _IEGetObjByName. It prints 0.Below is the code snippet I am talking about. I am new to autoIT. #include <IE.au3>Local $Link = "D:\path\Example.html"Local $oIE = _IECreate($Link)Sleep(2000)Local $oForm = _IEFormGetObjByName ($oIE, "test123") Sleep(2000)Local $oSubmit = _IEGetObjByName($oForm, "submitExample")_IEAction($oSubmit, "click")_IELoadWait($oIE) I tried printing the return value for _IEFormGetObjByName and _IEGetObjByName. It prints 0.
Danp2 Posted June 19, 2015 Posted June 19, 2015 Can you post the HTML file? Latest Webdriver UDF Release Webdriver Wiki FAQs
Abiarch Posted June 19, 2015 Author Posted June 19, 2015 Below is the html script. <html><body><form name="test123" onSubmit="javascript:alert('ExampleFormSubmitted');" method="post"><input name="submitExample" type="submit" value="Submit"></form></body></html>
MuffinMan Posted June 19, 2015 Posted June 19, 2015 (edited) I saved your html file and your script and tried it. Since the HTML file is running locally, it was asking me to "Allow Blocked Content", which is what I think is throwing your script off. I modified the script to the below and it works. See if it works for you... #include <IE.au3> Local $Link = "D:\path\Example.html" Local $oIE = _IECreate($Link) _IELoadWait($oIE) Sleep(5000) Local $oForm = _IEFormGetObjByName ($oIE, "test123") Sleep(2000) Local $oSubmit = _IEGetObjByName($oForm, "submitExample") _IEAction($oSubmit, "click") _IELoadWait($oIE) Edited June 19, 2015 by MuffinMan
Abiarch Posted June 19, 2015 Author Posted June 19, 2015 Hi,I tried the same.But it just gives me the attach html page. I have attached the screen shot. No action is performed after that. The mouse click isnt performed on submit button. And also I have disabled "allow blocked content" by going to IE settings. So I am not finding that tab anymore.
MuffinMan Posted June 19, 2015 Posted June 19, 2015 Can you show what errors you are getting from the ScITE window? Have you tried turning on IIS and running this as a real webpage? Or making sure you set that drive path up as a trusted zone in IE? Maybe try disabling virus scan for a few minutes??This is what I get when I run your script:
Abiarch Posted June 22, 2015 Author Posted June 22, 2015 Good to know that its working for you as expected I am not getting any error in ScITE window. I tried adding my local html page to trusted site but it won't allow me as it is not an https page.The issue is _IEFormGetObjByName is not able to return the form value.Hence the error is 0.
Abiarch Posted June 22, 2015 Author Posted June 22, 2015 Could you please share with me your IE settings? I mean anything specific which would be disabled or not added here by me may be.
MuffinMan Posted June 22, 2015 Posted June 22, 2015 I am running IE8 (a job requirement) with the following settings (see below). If you are running a later version of IE, have you turned off Protected Mode?
Abiarch Posted June 29, 2015 Author Posted June 29, 2015 Hi,I am using the IE version 11. I cant find any option to turn protected mode off in security settings.I have attached the screen shot for you. Thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now