Jump to content

Text felt


 Share

Recommended Posts

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")
endif

I 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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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)

     

 

Link to comment
Share on other sites

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
endif

The 1st msgbox say 1

The 2nd msgbox do not show anything.

Yours sincerely

Kenneth.

Link to comment
Share on other sites

  • 2 weeks later...

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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")
EndIf

This 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

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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...