Jump to content

Getting "control ids, names" from IE


Recommended Posts

Sorry to come here with such a question (this is going to be my trademark it seems).

I'm writing a script now to stress test a webpage (not DoS, my company wants to test our supplier:) )

I never done that with autoit but i seems to get a handle on it quickly enough,but i have a problem.

How do I learn the pages buttons names or ids, so I can interact with them?

Local $oLoginButton = _IEGetObjById($oIE, "login_button")
_IEAction($oLoginButton, "click")

how do I know/learn the "login_button" name as the browser refar to the button? I can probably mine it out from the sourcecode, but that would take an immense amount of time compared to, well anything.

 

Edit: and by mining, I mean search for it manually, I know only a few professinaly sounding words about datamining

 

Thank you guys! I hope others may find my questions usefull one day :)

Edited by SorryButImaNewbie
Link to comment
Share on other sites

What is the error you're receiving with this code?

Local $oLoginButton = _IEGetObjById($oIE, "login_button")
_IEAction($oLoginButton, "click")

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Thank you guys! I go with Bert's suggestion (I dont want to talk with IT security to check debugbar and etc, company standard) but thanks for it alienclone.

I only learnt unfourtunetly what i manually found from the HTML code.

what should i do If there are more then 1 control with the same class? I think there should be an index or something, that allows to differentiate between the controls, but can't find it.

I would like to click on a link (image basicly if im right) with something like this

Local $oLinks = _IELinkGetCollection($Explorer)
        For $oLink In $oLinks
            Local $sMyString = "somethingsomething"
            Local $sLinkText = _IEPropertyGet($oLink, "innerText")
            If StringInStr($sLinkText, $sMyString) Then
                _IEAction($oLink, "click")
                ExitLoop
            EndIf
        Next

so what if there are 4 "somethingsomething"? The only thing that is different is the link they send me. (href)

An other code i try is

If $x = 1 And $y = 1 Then
        $oLink = _IEGetObjById($Explorer, "/vasarlas?kategoria=d1&ervenyesseg=2") ;A tovább gombra nyomás a címbeállítás után
        _IEAction($oLink, "click")
        _IELoadWait($Explorer);MsgBox(0, "Teszt","Itt vagyok!")
    EndIf

where I tried to use the link's string to identify the link, but it doesnt work

Link to comment
Share on other sites

  • Moderators

Do you know what an "id" is (_IEGetObjByID())?

Because, I'm pretty sure: "/vasarlas?kategoria=d1&ervenyesseg=2" is not an ID.

I'm also pretty sure that if you're using AutoIt at work to program, that your IT department won't have an issue allowing you to install a tool that allows you to get all the information you're looking for.  And will be thankful that you're running code on their machines that you've used the proper tools to find the correct values for.

If you're not doing the programming at work, then download the tool, use the green drag icon to drag over (and drop) on the control/link/etc you want to work with.  Within the innertext it will give you the data you need.

The only other option you're going to get really is to post the url you're working with, for those of us that do have the proper tools (eg. debugbar) can take a look.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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