Sign in to follow this  
Followers 0
SorryButImaNewbie

Getting "control ids, names" from IE

9 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Autoit has a info tool that will tell you control names. Look in your autoit installation directory. It's called Au3Info.exe.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Yeh but in a browser it only says Internet Explorer_Server (as it should) on the entire browser 

Share this post


Link to post
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

 

Share this post


Link to post
Share on other sites

if @error Then
	MsgBox(262192,"",@ComputerName&" slaps "&@UserName&" around a bit with a large trout!")
	EndIf

>Exit code: 0

REAL search results

"Yeah yeah yeah, patience. How long will that take?"  -Ed Gruberman

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Okey I tried both, but they gave me no usefull information regarding the controls, no names/ids what ever. I doubt that they have any... what can i do?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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.

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  
Followers 0