Jump to content
Sign in to follow this  
Ubermensch

[SOLVED] Issue in detecting IE element by name ($_IESTATUS_ClientDisconnected and $_IESTATUS_InvalidObjectType)

Recommended Posts

Hello guys,

I am new here in our forum. I do have a little knowledge about AutoIt. I hope you could assist me. :)

I am currently working on a project. I want to try to create an automated time tracking tool.

This is how I want to function our time tracking tool.

  • Start time when the IE "get" button  is clicked.
  • End time when either "Next Step", "Save" or "Cancel" button is clicked.
  • All the values in the available fields will be stored in an Excel

I already have codes for the time tracking part, unfortunately, I cannot proceed since I am encountering an error for detecting the buttons in IE.

Here is my initial code for detecting the IE button.

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html")

Local $oLastName = _IEFormElementGetObjByName($oIE, "Text4")
Local $oGetItem = _IEFormElementGetObjByName($oIE, "getitem")

_IELoadWait($oIE)
_IEAction($oGetItem, "click")


MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem))

Here is the console output.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3" /UserParams    
+>23:22:20 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3
+>23:22:20 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementGetValue, $_IESTATUS_InvalidDataType
+>23:22:23 AutoIt3.exe ended.rc:0
+>23:22:23 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.105

Here are the errors.

--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementGetValue, $_IESTATUS_InvalidDataType

And here is my HTML code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>


<style type="text/css">
.style1 {
    text-align: left;
}
.style3 {
    font-family: Arial;
    font-size: 9pt;
    color: #CC00FF;
    margin: 0;
    padding: 0;

}
.style4 {
    font-family: Arial;
}
.style5 {
    font-size: 9pt;
}
.style6 {
    color: #CC00FF;
}
.style7 {
    background-color: #FF9999;
}
.style8 {
    font-family: Arial;
    font-size: 7pt;
    color: #CC00FF;
}
.style9 {
    font-size: 7pt;
}
.style10 {
    border: 2px solid #CC00FF;
}
.style11 {
    text-align: center;
}
.style12 {
    border: 1px solid #CC00FF;
}
.style13{
    clear: both;
    width: 525px;
    height: 45px;
    background: url(file:///C:/Users/april/Documents/JRB/AutoIt/AutoBOT/AWD10/lockedby.png) no-repeat;
    margin: 0;
    padding: 0;
    list-style: none;

}
.style14{ 
    float: right; 
    margin: 0px 0px 0 0; 
    width: 290px; 
    height: 25px;  
}

.style15{ 
    float: left; 
    margin: 0px 0px 0 0; 
    width: 290px; 
    height: 25px;  
}


.style16 {
    font-family: Arial;
    font-size: 2.5pt;
    color: #CC00FF;
    margin: 0;
    padding: 0;
}
.style17 {
    font-family: Arial;
    font-size: 7pt;
    color: #CC00FF;
    margin: 0;
    padding: 0;
}

.style18 {
    border-color: transparent;
    border: none;
    background-color:transparent;
    font-family: Arial;
    font-size: 8pt;
    

}


</style>
</head>

<body>
<input type="button" name="getitem" value="get" onclick="
    document.getElementById('filename').value = 'Life - ' + Random() + ' INVESTTAUTH - Process - Updateable - Assigned To: Jejeje - Create Date/Time: 2017-05-26-11.12.45.109044 - POL: 046054173 - TYPE: POLICY - SLA: 06/05/2017 ADMIN SYS: VP -PLC: 14'
    document.getElementById('businessarea').value = 'BusinessArea' + Random()
    document.getElementById('worktype').value = 'Worktype' + Random()
"/><br/>
<table style="width: 25%" align="center" class="style10">
    <tr>
        <td style="width: 525px">

<img src="C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\openitems.png" width="525px" height="28" /><br />
<div class="style13" style="height: 28px; width: 514px;">
     <div class="style14" style="height: 11px; width: 110px;">
        
        <label id="username"><span class="style16">&nbsp;</span><span class="style3"><br />
        </span><span class="style17">
        <script type="text/javascript">
                    var WinNetwork = new ActiveXObject("WScript.Network");
                    document.write(WinNetwork.UserName);
        </script>
    </span>
    </label>                
    </div>
    
     <div class="style14" style="height: 11px; width: 52px;">
        
        <label id="Label4"><span class="style16">&nbsp;</span><span class="style3"><br />
        </span><span class="style17">Locked by </span>
        </label>                
    </div>

        <div class="style15" style="height: 11px; width: 351px;">
        
                
        
        
                <form method="post" id="openfile" class="style15" style="width: 341px">
        
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input name="file" id="filename" class="style18" type="text" style="width: 200px; height: 10px" /></div>
        </form>

</div>
<label id="Label3"><span class="style3"><br/>
&nbsp; </span><span class="style8"><strong>&nbsp;LTC Claims Indexing Form</strong></span><span class="style3"><br />
<br/>
</span></label>
<form method="post" id="formawddata" style="width: 495px">
            <fieldset name="Group1" style="width: 495px" class="style12">
            <legend class="style8"><strong>AWD Data</strong></legend>
            <table style="width: 100%">
                <tr>
                    <td style="width: 86px" class="style3">&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="style9">Business Area:</span></td>
                    <td style="width: 144px" class="style8"><input name="Text4" id="businessarea" class="style18" type="text" /></td>
                    <td style="width: 45px" class="style8">Worktype:</td>
                    <td class="style8"><input name="Text5" id="worktype" class="style18" type="text" /></td>
                </tr>
            </table>
            </fieldset><br />
</form>

<form method="post" id="doc" style="width: 495px">
    <fieldset name="Group1" style="width: 495px; height
    : 55px;" class="style12">
    <legend class="style8"><strong>Document Data</strong></legend>
    &nbsp;&nbsp;&nbsp; <span class="style8">Document Type</span><br />
    &nbsp;&nbsp;&nbsp; <span class="style4"><span class="style9"> <select name="Select1" id="documenttype" style="width: 363px">
  <option></option>
  <option value="Doc1">Doc1</option>
  <option value="Doc2">Doc2</option>
  <option value="Doc3">Doc3</option>
  <option value="Doc4">Doc4</option>
  <option value="Doc5">Doc5</option>
  <option value="Doc6">Doc6</option>
    <option value="Doc7">Doc7</option>
  <option value="Doc8">Doc8</option>
  <option value="Doc9">Doc9</option>
    <option value="Doc10">Doc10</option>
  <option value="Doc11">Doc11</option>
  <option value="Doc12">Doc12</option>
  <option value="Doc13">Doc13</option>
  <option value="Doc14">Doc14</option>
    <option value="Doc15">Doc15</option>
  <option value="Doc16">Doc16</option>
  <option value="Doc17">Doc17</option>
    <option value="Doc18">Doc18</option>
  <option value="Doc19">Doc19</option>
  <option value="Doc20">Doc20</option>


    </select></span></span></fieldset><br />
</form>

<form method="post" id="myForm"style="width: 495px; height: 103px;">
    <fieldset name="Group1" style="width: 495px; height: 95px;" class="style12">
    <legend class="style8"><strong>Policy Data</strong></legend>
    &nbsp;&nbsp;&nbsp; <span class="style8">Claim Number&nbsp;</span><span class="style3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="style8">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    Policy Number/LTC ID</span><br />
    &nbsp;&nbsp;&nbsp; 
    <input name="Text1" id="claimnumber" type="text" style="width: 153px" class="style7" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="Text2" id="policynumber"type="text" style="width: 152px" class="style7" /><br />
    &nbsp;&nbsp;&nbsp; <span class="style8">Company Code</span><br />
    &nbsp;&nbsp;&nbsp; <span class="style7">
    <span class="style4"><span class="style9">
    <select name="Select2" id="companycode" style="width: 157px">
    <option></option>
  <option value="CC00001">CC00001</option>
  <option value="CC00002">CC00002</option>
  <option value="CC00003">CC00003</option>
  <option value="CC00004">CC00004</option>
  <option value="CC00005">CC00005</option>
    <option value="CC00006">CC00006</option>
  <option value="CC00007">CC00007</option>
  <option value="CC00008">CC00008</option>
    <option value="CC00009">CC00009</option>
  <option value="CC000010">CC000011</option>
  <option value="CC000011">CC000011</option>
  <option value="CC000012">CC000012</option>
  <option value="CC000013">CC000013</option>
    <option value="CC000014">CC000014</option>
  <option value="CC000015">CC000015</option>
  <option value="CC000016">CC000016</option>
    <option value="CC000017">CC000017</option>
  <option value="CC000018">CC000018</option>
  <option value="CC000019">CC000019</option>
    <option value="CC000020">Doc20</option>

    </select></span></span></span></fieldset></form><table style="width: 95%; height: 114px;">
    <tr>
        <td style="height: 23px; width: 212px;" class="style1">
    
<form method="post" style="width: 173px" >
    <fieldset name="Group1" style="width: 175px; height: 64px;" class="style12">
    <legend class="style8"><strong>Routing</strong></legend>
    &nbsp;&nbsp;&nbsp; 
    <span class="style4"><span class="style6"> 
    <span class="style5"><span class="style9"> 
    <input name="Radio1" type="radio" checked="checked" value="1" /></span></span><span class="style9">Indexed<br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="style5"><span class="style9"> <input name="Radio1" type="radio" value="2" /> 
    Reroute</span></span></span></span></fieldset></form></td>
        <td style="height: 23px">
                <span class="style8">AWD Comments</span>
        <form method="post" id="awdcomments" style="width: 278px; height: 47px">
            <textarea name="TextArea1" style="width: 273px; height: 59px" cols="20" class="style7"></textarea></form><br />
        </td>
    </tr>
</table>

<br />

    <div class="style11">

  <input name="button1" type="button" onclick="myFunction()" value="Next Step"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
    <input name="button2" type="button" onclick="myFunction()" value="Save" style="width: 91px"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="button3" type="button" onclick="myFunction()" value="Cancel" style="width: 94px"/>
<script>
function myFunction() {
        document.getElementById("doc").reset();
        document.getElementById("myForm").reset();
        document.getElementById("awdcomments").reset();
        document.getElementById("formawddata").reset();
        document.getElementById("openfile").reset();
        document.getElementById("businessarea").reset();
        document.getElementById("worktype").reset();
        document.getElementById("documenttype").reset();
        document.getElementById("policynumber").reset();
        document.getElementById("companycode").reset();
        document.getElementById("claimnumber").reset();
        document.getElementById("Label4").reset();

    
}
</script>

<script type="text/javascript">
        function Random() {
            return Math.floor(Math.random() * 10000000);
        }


    </script>
    <br />
    <br />
</div>
</td>
</tr>

</table>


<p>
        
                
        &nbsp;</p>
&nbsp;

</body>

</html>

I hope you could assist me. Thank you in advance! ^_^

Edited by Ubermensch

Share this post


Link to post
Share on other sites

You can resolve the initial error by setting the $iWait parameter to 0.

Local $oIE = _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html", 0, 1, 0)

The next issue is that you are calling _IEFormElementGetObjByName with the incorrect first parameter. Instead of passing a reference to the IE object, you need to pass the appropriate form object.

Also, you probably need to use _IEGetObjByName to get the reference to the "getitem" button since it doesn't appear to reside within a form.

Share this post


Link to post
Share on other sites
13 hours ago, Danp2 said:

You can resolve the initial error by setting the $iWait parameter to 0.

Local $oIE = _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html", 0, 1, 0)

The next issue is that you are calling _IEFormElementGetObjByName with the incorrect first parameter. Instead of passing a reference to the IE object, you need to pass the appropriate form object.

Also, you probably need to use _IEGetObjByName to get the reference to the "getitem" button since it doesn't appear to reside within a form.

Hello @Danp2,

I have tried your code and it already solve the "Disconnected" error.

But unfortunately, the object still not detected.

Here is the new code I have used.

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0)

Local $oLastName = _IEGetObjByName($oIE, "Text4")
Local $oGetItem = _IEGetObjByName($oIE, "getitem")

_IELoadWait($oIE)
_IEAction($oGetItem, "click")

Here is the console output.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3" /UserParams    
+>21:15:19 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3
+>21:15:19 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1875) : ==> The requested action with this object has failed.:
If IsObj($oObject.document.GetElementsByName($sName).item($iIndex)) Then
If IsObj($oObject^ ERROR
->21:15:20 AutoIt3.exe ended.rc:1
+>21:15:20 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 2.099

Here are the errors.

If IsObj($oObject.document.GetElementsByName($sName).item($iIndex)) Then
If IsObj($oObject^ ERROR

Share this post


Link to post
Share on other sites

Looks like you'll need to use _IEAttach to get a valid reference to the created IE instance. Here's one way to do it --

#include <IE.au3>
#include <MsgBoxConstants.au3>

_IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0)
Local $oIE = _IEAttach("", "instance", 1)
_IELoadWait($oIE)

Local $oLastName = _IEGetObjByName($oIE, "Text4")
Local $oGetItem = _IEGetObjByName($oIE, "getitem")

_IEAction($oGetItem, "click")

MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem))

 

Share this post


Link to post
Share on other sites
35 minutes ago, Danp2 said:

Looks like you'll need to use _IEAttach to get a valid reference to the created IE instance. Here's one way to do it --

#include <IE.au3>
#include <MsgBoxConstants.au3>

_IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0)
Local $oIE = _IEAttach("", "instance", 1)
_IELoadWait($oIE)

Local $oLastName = _IEGetObjByName($oIE, "Text4")
Local $oGetItem = _IEGetObjByName($oIE, "getitem")

_IEAction($oGetItem, "click")

MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem))

 

Thanks Danp2.

I have tried the updated code and unfortunately, still not getting a match.

I also tried to tweak it, but it is still not working.

Here is the console output.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" /UserParams    
+>22:59:31 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3
+>22:59:31 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: Text4, Index: 0)
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: getitem, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementGetValue, $_IESTATUS_InvalidDataType
+>22:59:33 AutoIt3.exe ended.rc:0
+>22:59:33 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.557

By the way, does #RequireAdmin connected to the issue?

Share this post


Link to post
Share on other sites
16 minutes ago, Danp2 said:

It worked for me when no other instance of IE was loaded. If you have other active tabs, then you will need to adjust the _IEAttach or come up with another way to get the reference to the correct IE instance.

I have given another try the code and it is already working now. ;)

It's kinda weird since it is not working earlier. :sweating:

Thanks a lot with the help! Your the best! B)

Can I contact you again if I have other questions?!? :lol:

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By walec
      Hey
      I have problem with Set Value for control slider on webside.
      Anyone have any idea for a solution?
       
      I tried but it doesn't work.
      Local $Strength = _IEGetObjById($oIE_Strona, "strength_value") Local $oText = _IEFormElementGetObjByName($Strength, "valuee") _IEFormElementSetValue($oText, "6") or
      _IENavigate ($oIE_Strona, "https://guantanamo.prisonwarsonline.com/gym/") Local $oDiv = $oIE_Strona.Document.GetElementByID("strength_value") Local $oAttribute = $oDiv.getAttribute("valuee") If IsObj ( $oAttribute ) Then $oAttribute.value = "6" EndIf Best Regards
    • By Mariog2000
      I've tried for a few days to simply open a url in IE and click an IE object that I can't "TAB" to and don't want to use a mouse-click if at all possible.  I've read up on things like using IEAction and IETagNameGetCollection to find the object but not smart enough to figure out how that works with my url or how to tell if my url is "basic" or a "form", "frameset", "iframe", etc.
      The other problem is I've tried using the "Run" and "ShellExecute" commands to open the browser, which works, but it opens it in a way that doesn't include my currently logged in user account.  For example, if I just click IE or Chrome for that matter and open my default homepage of google, the page that opens knows I'm logged in.  When I use "Send" "ShellExecute" or "_IE_Create" they always open pages generically which would require a login.
      So questions are, if I have a URL I'm trying to open, that's passes the currently logged on users credentials when opening the page (no clue where that happens)
      1.  Are there any code examples someone is willing to share that opens my IE maximized, with logged in credentials, and
      2.  Once that works, can someone suggest a technique a non-developer can find which IE Objects I need to send a "click" to so it opens the correct menu, pop-up, url, etc., associated with that object.  I've copied what doesn't work and sure I'm way off but it's not for a lack of effort. I'll keep trying and post updates but not looking good 🙂
      #include <IE.au3>
      Call ("selection")
      Func selection ()
      Global $oIE = _IECreate ("https://internal-webpage.aspx")
      Local $selectid = _IEGetObjByName ($oIE, "signageNo")
      Local $button = _IEGetObjByName ($oIE, "GO")

      _IEFormElementOptionSelect ($selectid, "3")
      _IEAction ($button,"click")
      EndFunc
      #include <IE.au3> Call ("selection") Func selection () Global $oIE = _IECreate ("https://internal-webpage.aspx") Local $selectid = _IEGetObjByName ($oIE, "signageNo") Local $button = _IEGetObjByName ($oIE, "GO") _IEFormElementOptionSelect ($selectid, "3") _IEAction ($button,"click") EndFunc 1. 
    • By zuladabef
      I want to set the value of a input, but I only have the input name and input id.  I cannot find a form in the source.  Form collection does not return any results.  
      Is there a way to use FormElementSetValue without a form name? Can I use _IEGetObjByName or _IEGetObjById?  If so, how do I set the value once I have the object? Where do I go from here? Local $oIE = _IEAttach("[Website Goes Here"]) Local $oForm = _IEFormGetCollection($oIE, 1) Local $oQuery = _IEFormElementGetCollection($oForm, 4) _IEFormElementSetValue($oQuery, "Set it to this")  
    • By Seminko
      Hey there,
      below function returns an "object collection" (not sure if that's the correct term) of 'a' elements grabbed from within //*[@id="J_DetailMeta"].
      However, I need the returned collection not to include objects with 'aria-disabled = true'. Is there a way of removing specific objects from such a collection?
      Func GetObjectList($sPicker) $oDetailMeta = _IEGetObjById($oIE, "J_DetailMeta") If Not @error Then $tags = $oDetailMeta.GetElementsByTagName("ul") For $tag in $tags $data_ID_value = $tag.GetAttribute("data-property") If $sPicker = "color" Then If $data_ID_value = '????' Or $data_ID_value = "????" Then $oReturnList = $tag.GetElementsByTagName("a") EndIf ElseIf $sPicker = "network" Then If $data_ID_value = '????' Then $oReturnList = $tag.GetElementsByTagName("a") EndIf ElseIf $sPicker = "storage" Then If $data_ID_value = '????' Then $oReturnList = $tag.GetElementsByTagName("a") EndIf EndIf Next EndIf Return $oReturnList EndFunc $oColorList = GetObjectList("color") For $oColor In $oColorList If StringInStr($oColor.GetAttribute("aria-disabled"), "true") <= 0 Then ; remove object from the collection ??? EndIf Next  
    • By careca
      Hi, i feel im close to getting it to work, but there must be something im missing that's probably easy for you experts.
      #include <IE.au3> #include <File.au3> #include <MsgBoxConstants.au3> $Visible = 1 Local $oIE $oIE = _IECreate("https://beemp3s.net/mp3-download.html", 0, $Visible, 1, 1) _IELoadWait($oIE) If $oIE <> @error Then ;_ArrayText() _QuerySite('Finding Hope - Without You') ;_IEQuit($oIE) ;Exit Else MsgBox(64 + 262144, 'Fail', 'Could not create a new window') EndIf ;============================================================================= Func _QuerySite($Name) Local $oIE_ObjectToSearch = _IEGetObjById($oIE, 'query') _IEDocInsertText($oIE_ObjectToSearch, $Name) Local $oIE_ObjectToClick = _IEGetObjById($oIE, "search-action") _IEAction($oIE_ObjectToClick, 'click') _IELoadWait($oIE, 2000) ;============================================================================= Local $oSubmitClick = _IEGetObjById($oIE, "col-md-12") _IEAction($oSubmitClick, "click") _IELoadWait($oIE, 2000) ;============================================================================= Local $oBtns = _IETagNameGetCollection($oIE, "div") For $oBtn In $oBtns If String($oBtn.classname) = "col-md-12" Then If String($oBtn.innertext) = "Download / Play" Then ConsoleWrite($oBtn.innertext & @CRLF) _IEAction($oBtn, 'click') EndIf EndIf Next ;============================================================================= ;Local $oElements = _IETagNameAllGetCollection($oIE) ;For $oElement In $oElements ; If $oElement.id Then MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $oElement.id & @CRLF & "innerText: " & $oElement.innerText) ;Next ;============================================================================= ;_IEQuit($oIE) ;Exit ;============================================================================= EndFunc ;==>_QuerySite ;============================================================================= Func _ArrayText() If FileExists('Titles.txt') Then Local $FO = FileOpen('Titles.txt') Local $R2A = FileReadToArray($FO) Local $iLineCount = @extended FileClose($FO) For $f = 0 To $iLineCount - 1 ConsoleWrite($f & ' - ' & $R2A[$f] & @CRLF) _QuerySite($R2A[$f]) Next Else MsgBox(64 + 262144, 'Fail', 'Could not find the file Titles.txt') EndIf EndFunc ;==>_ArrayText ;============================================================================= The idea is to get into this site, write into the search and click, which i did, but now the problem is clicking in any of the buttons in the results page, im looking for a way to click the first one, it always matches to what i want, so no need to fiddle around.
      Site
      Thanks for help in advance.

×
×
  • Create New...