Jump to content
Sign in to follow this  
Dequality

Need help IE automation.

Recommended Posts

I don't really have any code cuz whatever i try it doesnt work -.- 

Can anyone please make me a sample i can study? <,< i need to make a simple script to open explorer click some objects on the site , rinse repeat.. a example with autoit' website is just fine i just need to study it.. the i can't seem to find any yt video on this.. '-_-

And yes i tried looking at the manual .. but i dont get anything from it <.<'

 

Any help highly appreciatet <3 

Edited by Dequality

Share this post


Link to post
Share on other sites
ERROR CODE

--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: Activity, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
#include <IE.au3>

$oIE = _IECreate("https://www.autoitscript.com/forum/", 0, 1, 1, 0)
Sleep(5000)
$Activity = _IEGetObjByName($oIE, "Activity")

_IEAction($Activity, "click")

 

Share this post


Link to post
Share on other sites
26 minutes ago, Dequality said:

Can anyone please make me a sample i can study?

There are quite a tons on the forums and on the Help file, where you should start looking at from.

The console is telling you exactly what your script is doing, so, you don't need any help from anyone.

Just understand what you have done.


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Just now, FrancescoDiMuro said:

There are quite a tons on the forums and on the Help file, where you should start looking at from.

The console is telling you exactly what your script is doing, so, you don't need any help from anyone.

Just understand what you have done.

Well.. ty i guess? :blink:

Share this post


Link to post
Share on other sites

Assuming that your snippet of code was trying to click the "Activity" tab below:

image.png.1352956374d028bab3d2d343319a1899.png

If you look at the actual HTLM source for that link, it looks like:

<a href="https://www.autoitscript.com/forum/discover/unread/" data-navitem-id="2">Activity</a>

As you can see, that tag does not have a "name" attribute equal to "Activity" (name="Activity").  As a matter of fact, no tag on that page has an attribute with name="Activity".  That is why you got the NoMatch error.

What it appears you were trying to do was to click the link whose text was "Activity".  If so, then you want something similar to:

#include <IE.au3>

Local $oIE = _IECreate("https://www.autoitscript.com/forum")

_IELinkClickByText($oIE, "Activity")

If you were not trying to click that link, maybe a better explanation of what you were trying to do would help.

As FrancescoDiMuro said, the help file and forum are full of examples.  Spending some time looking thru the _IE* functions and their examples in the Help file, as well as the IE_Example example and trying to understand what is going on in those examples, should give you a solid foundation upon which to build upon.  If you actually spent time looking thru them, as you said, and got nothing from it, I doubt that you would get anything more from any additional examples that anyone else could provide.

Share this post


Link to post
Share on other sites

Well, it may sound obvious for those who spent hundreds of hours scripting a specific UDF.  But I understand the one who is starting and facing with  this incredible amount of information.  Been there too.  So thanks for @TheXman to give a clear explanation of the mechanics behind it.

 

Share this post


Link to post
Share on other sites
6 hours ago, TheXman said:

Assuming that your snippet of code was trying to click the "Activity" tab below:

image.png.1352956374d028bab3d2d343319a1899.png

If you look at the actual HTLM source for that link, it looks like:

<a href="https://www.autoitscript.com/forum/discover/unread/" data-navitem-id="2">Activity</a>

As you can see, that tag does not have a "name" attribute equal to "Activity" (name="Activity").  As a matter of fact, no tag on that page has an attribute with name="Activity".  That is why you got the NoMatch error.

What it appears you were trying to do was to click the link whose text was "Activity".  If so, then you want something similar to:

#include <IE.au3>

Local $oIE = _IECreate("https://www.autoitscript.com/forum")

_IELinkClickByText($oIE, "Activity")

If you were not trying to click that link, maybe a better explanation of what you were trying to do would help.

As FrancescoDiMuro said, the help file and forum are full of examples.  Spending some time looking thru the _IE* functions and their examples in the Help file, as well as the IE_Example example and trying to understand what is going on in those examples, should give you a solid foundation upon which to build upon.  If you actually spent time looking thru them, as you said, and got nothing from it, I doubt that you would get anything more from any additional examples that anyone else could provide.

I wan't to be able to find a button by _IEObjGetById/Name seems like its more reliable? :think: but ty a lot for the explanation! will try it out right now :)!

 

#include <IE.au3>

$oIE = _IECreate("https://www.autoitscript.com/forum/", 0, 1, 1, 0)
Sleep(5000)
_IELinkClickByText($oIE, "Activity")

I tried this now, no error but still didnt click anything? :think: 

Edited by Dequality

Share this post


Link to post
Share on other sites
1 hour ago, Dequality said:

I tried this now, no error but still didnt click anything?

To say that, you should check for an error, and you do it with

If @error Then
    ConsoleWrite("Error calling FunctionName. Error: " & @error & @CRLF)
Else
    ; Do something
EndIf

 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
5 hours ago, FrancescoDiMuro said:

To say that, you should check for an error, and you do it with

If @error Then
    ConsoleWrite("Error calling FunctionName. Error: " & @error & @CRLF)
Else
    ; Do something
EndIf

 

Think i fixed it, it's working properly now but i have to hit a button which is written in java is that possible? :think: 

<a href="javascript:void(0);" onclick="return('0', '427', 'autotrainer', '', '', '', '525251', '', '', '', '30', '');"><strong>btn</strong> <br><small><i>30 </i></small></a>

this is the text i get when i right click > inspect the element :think: 

Edited by Dequality

Share this post


Link to post
Share on other sites
11 hours ago, Dequality said:

I tried this now, no error but still didnt click anything?

Was trying to see if I had the same problem as you.  And Yes I had. So after few hours of testing I finally found that there is 2 "Activity" links and it's the second link that works.

Share this post


Link to post
Share on other sites
On 04/01/2019 at 5:25 PM, Nine said:

Was trying to see if I had the same problem as you.  And Yes I had. So after few hours of testing I finally found that there is 2 "Activity" links and it's the second link that works.

How did you find the second one? 

Share this post


Link to post
Share on other sites
5 hours ago, Dequality said:

How did you find the second one? 

$collection = _IELinkGetCollection ($oIE)

$c = 0
for $obj in $collection
  If not $obj.id Then ContinueLoop
  $c += 1
  $arr[$c][0] = $obj.name
  $arr[$c][1] = $obj.id
  $arr[$c][2] = $obj.innerText
  $arr[$c][3] = $obj.outerText
Next

_ArrayDisplay ($arr)

 

Share this post


Link to post
Share on other sites

@Nine
Shouldn't you set $c+=1 before the Next command?

Spoiler
#include <Array.au3>

Global $intRow = 0, _
       $arrSomeArray[10][1]

For $i = 0 To 9 Step 1
    $arrSomeArray[$intRow][0] = $intRow
    $intRow += 1
Next

_ArrayDisplay($arrSomeArray)

 

In this way, you have one row that is not filled :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
5 minutes ago, FrancescoDiMuro said:

@Nine
Shouldn't you set $c+=1 before the Next command?

  Reveal hidden contents
#include <Array.au3>

Global $intRow = 0, _
       $arrSomeArray[10][1]

For $i = 0 To 9 Step 1
    $arrSomeArray[$intRow][0] = $intRow
    $intRow += 1
Next

_ArrayDisplay($arrSomeArray)

 

In this way, you have one row that is not filled :)

yes i know but it is only a debugging tool, I thought you would have known that :huh2:

Share this post


Link to post
Share on other sites

@Nine
Yeah, sure 
:)
 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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 adityaparakh
      Hello ,

      https://secure.icicidirect.com/customer/login

      This is the website I am trying to login with my credentials.
      And retrieve the cookie into a text file.
      Unable to do so.
      Is it that certain,  Httponly , type - are not allowed to be fetched.

      Then further ,
      I will be checking every 5 minutes if my session is active , else re-login and re-fetch the cookie.
      For the second part , I will probably fetch some table and see if not in appropriate format do Part 1 : Fetch Cookie - again.
      Any better way , tips would be appreciated.
       
      Thanks
       
    • By Jamestay97
      Hello! Thanks you for looking at my post
      **No source code I'm sorry work related can't copy information**
      I've been using autoit for about 1 year. 
      I'm having trouble automating a click on an internet explorer web page and I've tried a lot of examples from help pages and forums already. The object I'm trying to click on isnt always in the same spot so I can't use mouse click or control click, I have tried to use the different get collection options and clickbyname, or index or get object. I'm just struggling. 
      Description of object I'm trying to click -- 
      HTML Code looks like <a ng-click.. "Click Here" it appears it's just a click able object named "click here" that opens a hidden window by running a script inside the web page. I'm not able to grab the information from the window unless it's open so I have to automate this click somehow. 
       
      I understand it's difficult to assist without having something to look at, I apologize for that sincerely and appreciate and assistance and suggestions. 
    • By FUD
      hello 
      please i need help 
      i need to open link in default browser only one windows without duplicate if i try to open the same link 
       
      thanks 
    • 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 singh54
      Hello All,

      I am new to auto It  and coding. Have only tried few automated logging for different websites.  The login pages of the websites which I have worked on were having form name with input type as text and it seems straight forward to automate their login using "_IEFormElementSetValue".
      I have got a url, it does not have any form in the source page. On further analyzing I found that It does call some login page separately as below.
      function showLogin(arg) {
        Global.pollingDialogDoc = null;
        var fresh = jQuery.isValidString(arg) && "fresh" == arg ? !0 : !1, appFrame = $("#appFrame");
        if ($("#modalFrame").show(), $("iframe").hide(), fresh || !appFrame.attr('src').match("html/login.html")) appFrame.attr('src', baseURL + 'html/login.html'), 
        appFrame.on('load', function() {
          setTimeout(function() {
            $("#modalFrame").hide(), appFrame.show();
          }, 1);
        }); else try {
          window.frames.appFrame.updatePageFromIndex();
        } catch (e) {}
      }
      I can simply use "send" and "mouse click" Method to automate the login but that doesn't seems very reliable. Is there any separate way to fill the user ID and password to the respective fields by having reference by frames or something. 
      Appreciate if any one can point me to correct document or help in any way...!
×
×
  • Create New...