Valnurat Posted December 9, 2015 Share Posted December 9, 2015 I'm trying to attach to an element in IE, but I really don't have any idea how to start. This is what I done: If not WinExists("ServiceNow - Microsoft Internet Explorer") Then Local $oIE = _IECreate("https://service-now.com/") _IELoadWait($oIE) EndIf Sleep(10000) if WinExists("ServiceNow - Microsoft Internet Explorer") Then WinActivate("ServiceNow - Microsoft Internet Explorer") Local $oForm = _IEFormGetObjByName($oIE, "display: inline-block;") Local $oText = _IEFormElementGetObjByName($oForm, "filter") _IEFormElementSetValue($oText, "create new") endifI can't see the text "create new" has been typed. This is what I can see when I'm using Debugbar: <form style="display: inline-block;" action="javascript:void(null);"><input title="Type filter text" align="left" id="filter" accesskey="f" type="text" placeholder="Type filter text"><a title="Clear" id="nav_filter_controls" style="visibility: visible;"><img width="16" height="16" src="images/icons/nav_clear_2.png" border="0"></a></form>I hope someone can help me. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted December 9, 2015 Share Posted December 9, 2015 You need to add some kind of error checking to your script. Which of the calls to _IE* returns an error? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Valnurat Posted December 9, 2015 Author Share Posted December 9, 2015 I can see that _IEFormGetObjByName is returning an error. --> IE.au3 T3.0-2 Warning from function _IEFormGetObjByName, $_IESTATUS_NoMatch Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Jfish Posted December 9, 2015 Share Posted December 9, 2015 You are using the style tag as the form name. That is probably the first problem. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Valnurat Posted December 9, 2015 Author Share Posted December 9, 2015 Ok. I'm not sure what I have to look for.<div class="nav_controls nav_filter_spacing" style="white-space: nowrap;"><div style="float: right;"><button title="Show navigator controls" class="menu-button icon-menu" id="perspective_switcher" aria-label="Show navigator controls"></button></div><div class="nav_filter_wrapper"><div class="nav_filter_container"><button class="menu-button icon icon-star-empty" id="navigator_favorite_switcher"></button><form style="display: inline-block;" action="javascript:void(null);"><input title="Type filter text" align="left" id="filter" accesskey="f" type="text" placeholder="Type filter text"><a title="Clear" id="nav_filter_controls" style="visibility: hidden;"><img width="16" height="16" src="images/icons/nav_clear_2.png" border="0"></a></form></div></div></div> Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Jfish Posted December 9, 2015 Share Posted December 9, 2015 Not my strength but I don't see a name or id for the form so I think you may have to iterate a collection object to find the form (I am open to being corrected on that by folks that are more familiar with it). Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Danp2 Posted December 9, 2015 Share Posted December 9, 2015 A couple of suggestions for you:Your script will fail if the page is already loaded in IE ($oIE never gets defined). I would eliminate the first If...EndIf and just call _IECreate with the $TryAttach option, like this:Local $oIE = _IECreate("https://service-now.com/", 1)You can use _IEFormGetCollection to retrieve the form object by index. If there's only one form, then this will get the object for you:Local $oForm = _IEFormGetCollection($oIE, 0) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Valnurat Posted December 9, 2015 Author Share Posted December 9, 2015 I tried to do this:Local $oIE = _IECreate("https://service-now.com/", 1) _IELoadWait($oIE) Sleep(10000) if WinExists("ServiceNow - Microsoft Internet Explorer") Then WinActivate("ServiceNow - Microsoft Internet Explorer") Local $oForms = _IEFormGetCollection($oIE, 0) Local $iNumForms = @extended MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & $iNumForms & " forms on this page") Local $oForm For $i = 0 To $iNumForms - 1 $oForm = _IEFormGetCollection($oIE, $i) MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name) Next endifThe 1st msgbox say 1The 2nd msgbox do not show anything. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Danp2 Posted December 9, 2015 Share Posted December 9, 2015 Local $oIE = _IECreate("https://service-now.com/", 1) _IELoadWait($oIE)_IECreate already performs an _IELoadWait by default, so you should be able to drop the explicit one.The 2nd msgbox do not show anything.That makes sense because you have previously determined that the form has no name. ;-) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Valnurat Posted December 10, 2015 Author Share Posted December 10, 2015 Ok. I will delete _IELoadWait. I'm just trying to find solution on what you said about Form and index.If I do what you said: Local $oForm = _IEFormGetCollection($oIE, 0)Can you then tell me what I should do? Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Danp2 Posted December 10, 2015 Share Posted December 10, 2015 Have you tried this?:Local $oText = _IEGetObjById($oIE, "filter") _IEFormElementSetValue($oText, "create new") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Valnurat Posted December 21, 2015 Author Share Posted December 21, 2015 Sorry to say, but it does not work. It does not fill out field with "create new" Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
water Posted December 21, 2015 Share Posted December 21, 2015 Does any of the _IE* functions return an error? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted December 21, 2015 Share Posted December 21, 2015 Sorry to say, but it does not work.It does not fill out field with "create new"Not very helpful response.Does any of the _IE* functions return an error?This is key. Run the script and post the results from the Scite output window. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Valnurat Posted December 23, 2015 Author Share Posted December 23, 2015 Right now I only have this: Local $oIE = _IECreate("https://service-now.com/", 1) if WinExists("ServiceNow - Microsoft Internet Explorer") Then WinActivate("ServiceNow - Microsoft Internet Explorer") Local $oText = _IEGetObjById($oIE, "filter") _IEFormElementSetValue($oText, "create new") EndIfThis is the output in Scite output windows>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\DKSOKVK\Documents\RAD Studio\Projects\SSCreateNewIncident.au3" /UserParams +>13:58:11 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:00000406 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0809) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\DKSOKVK\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\DKSOKVK\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\DKSOKVK\Documents\RAD Studio\Projects\SSCreateNewIncident.au3 +>13:58:11 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\DKSOKVK\Documents\RAD Studio\Projects\SSCreateNewIncident.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch +>13:58:13 AutoIt3.exe ended.rc:0 +>13:58:13 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.417 Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Jfish Posted December 23, 2015 Share Posted December 23, 2015 I decided to go to that site in your code. I admit I did not study the page for very long but I did not see any forms (other than search). A search of the source code shows that search appears to be the only form. Are you sure the form you are after is on that page? Maybe it would help if you could state specifically what field you are trying to set on that page (with words not code)? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
water Posted December 23, 2015 Share Posted December 23, 2015 I couldn't find a form or an id "filter" in the source code.You are sure we are on the correct page? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 23, 2015 Share Posted December 23, 2015 Or do you talk about https://store.servicenow.com/$appstore.do#!/store/home where you can filter the results? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
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