Sign in to follow this  
Followers 0
dinodod

button control that I can't click

18 posts in this topic

I have this line that I am trying to perform a click event to but I can't get the right information for it.

<input type=button value="click here !" name=Mjg3Nzc2MzE onclick="MjQwNTY3NDM(Mjg3Nzc2MzE);"><br>

I tried using the Autoit Window info tool but this control is embedded inside a IEFrame. I cant seem to get the properties of the control SO I tried these command in hope I could trip onto it but still no luck:

$handle = ControlGetHandle($Window, "Click Here !", "Button")
msgbox(0,"",$handle)

$Test = ControlClick("Conquest - Windows Internet Explorer","","[CLASS:Button; TEXT:Here; Instance:1]")
msgbox(0,"","1 is good:  " & $Test )

Thoughts & TY?


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites



?


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Why not just use the _IE funcs?

Edit:

Oh, and download Dales suggested DebugBar

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

I'm looking into the _IE Funcs now, pretty useful. But I'm a bt confused over how to automate a site. I see where I get an object by using the IECreate but then how do i get the object refreshed when I navigate to a different page?

I am trying to fill in some forms and I *might* use the _IEFormSubmit -or- _IEAction to submit the page. Once submitted, I am taken to a different page (Different URL) and thus, my form object needs to be updated.

So far, all the examples show you how to manage a single page, but I need an example of how to manage an entire site.

I'll be looking for examples in the forums in the meantime.

Thanks!

-Karl


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

I'm looking into the _IE Funcs now, pretty useful. But I'm a bt confused over how to automate a site. I see where I get an object by using the IECreate but then how do i get the object refreshed when I navigate to a different page?

I am trying to fill in some forms and I *might* use the _IEFormSubmit -or- _IEAction to submit the page. Once submitted, I am taken to a different page (Different URL) and thus, my form object needs to be updated.

So far, all the examples show you how to manage a single page, but I need an example of how to manage an entire site.

I'll be looking for examples in the forums in the meantime.

Thanks!

-Karl

The $oIE object continues to point to the browser (not the page) after you _IENavigate() to somewhere else.

Try out the excellent example scripts Dale included with IE.au3.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I'm looking into the _IE Funcs now, pretty useful. But I'm a bt confused over how to automate a site. I see where I get an object by using the IECreate but then how do i get the object refreshed when I navigate to a different page?

I am trying to fill in some forms and I *might* use the _IEFormSubmit -or- _IEAction to submit the page. Once submitted, I am taken to a different page (Different URL) and thus, my form object needs to be updated.

So far, all the examples show you how to manage a single page, but I need an example of how to manage an entire site.

I'll be looking for examples in the forums in the meantime.

Thanks!

-Karl

You can use psalty's advice about _IENavigate or if it's a page that's already open look at _IEAttatch.

You need to know all the forms you'll be dealing with for automation, that's just common sense. But if there are forms that are "standard" type, then there are plenty of functions to enumerate the forms and get information from.


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

#7 ·  Posted (edited)

Sweet, it's working but I ran into a snag that has made me very frustrated. I think I'm just too tired to think this one out but here goes....

Here are the two lines in a form that I am trying to understand. Note that the FORM tag has neither a ID or name. So I was referred to use the _IEFormGetCollection function.

If the desired form does not have a name or ID, _IEFormGetCollection to get a reference by index

Fine. So I looked up that function and saw it use _IEFormElementGetCollection to parse thru all the elements in the form(s). The problem is now I need to list all the elements and their pertinent details so that I can match up the correct element to the button i need to click. Or is there an easier way to get to the button and click it? _IEAction needs to refer to the FORMName to know which form to look in. I was thinking of injecting text into the HTML source but then I figured the web site would change and I'd be back to square one again.

Thoughts on how to click this button??

P.S. The code on the website changes the Name and onclick text in the button each time so referenceing by the name is useless. Nice anti-bot feature.

<form action=i.cfm?&zt4s&f=sc_research2&rtype=4 method=post>
<input type=button value="Start Research !" name=ynuerr onclick="xm81z6(ynuerr);"><br>
Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Fine. So I looked up that function and saw it use _IEFormElementGetCollection to parse thru all the elements in the form(s). The problem is now I need to list all the elements and their pertinent details so that I can match up the correct element to the button i need to click. Or is there an easier way to get to the button and click it? _IEAction needs to refer to the FORMName to know which form to look in. I was thinking of injecting text into the HTML source but then I figured the web site would change and I'd be back to square one again.

Thoughts on how to click this button??

P.S. The code on the website changes the Name and onclick text in the button each time so referenceing by the name is useless. Nice anti-bot feature.

<form action=i.cfm?&zt4s&f=sc_research2&rtype=4 method=post>
<input type=button value="Start Research !" name=ynuerr onclick="xm81z6(ynuerr);"><br>
When you use the various "collection" function in the IE UDF, you can specify a 0-based index to get a specific one (if you know it). For example, if you know that is the first form you could use:
$oForm = _IEFormGetCollection($oIE, 0)oÝ÷ Øêò¢ç(ºWn±æ§w^Æõ~íërÝjëh×6$oForm = _IEFormGetCollection($oIE, 1)oÝ÷ Ù8b±©l¡ªi'¬¶¶Ø§Ø^~æzW¦z{l!ûajÚÞjYrËayø«²Ú®¢Ø§¦ëjº^éÛaz|¨¹Ê.Û¬y«­¢+ØÀÌØí½%¹ÁÕÐô}%Q9µÑ
½±±Ñ¥½¸ ÀÌØí½½É´°ÅÕ½Ðí¥¹ÁÕÐÅÕ½Ðì°À¤

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks for the guidance, this is putting me on the track but I am having yet another issue. I am trying to understand how to display the properties of the collection cause I need to 'see' the ID of the button to verify that I am clicking on the right one since the NAME changes each time.

When I use the following code, I can see all the INPUTs including the one I need to click. BUT how do I see the IDs and other properties of the elements?? How do I know what the properties are for any given collection?

$oInputs = _IETagNameGetCollection ($oIE, "input")
        
For $oInput In $oInputs
    MsgBox(0, "Form Input Type", "Form: " & $oInput & " Type: " & $oInput.type &" | " & $oInput.Name)Next

Thanks!


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

If the site has a "nice anti-bot feature", what is its URL and why are we hacking it?


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Thanks for the guidance, this is putting me on the track but I am having yet another issue. I am trying to understand how to display the properties of the collection cause I need to 'see' the ID of the button to verify that I am clicking on the right one since the NAME changes each time.

When I use the following code, I can see all the INPUTs including the one I need to click. BUT how do I see the IDs and other properties of the elements?? How do I know what the properties are for any given collection?

$oInputs = _IETagNameGetCollection ($oIE, "input")
        
For $oInput In $oInputs
    MsgBox(0, "Form Input Type", "Form: " & $oInput & " Type: " & $oInput.type &" | " & $oInput.Name)Next
Try this example:
#include <IE.au3>

; Open example in IE
$oIE = _IE_Example("Form") 

; Display input tag info
$oForm = _IEFormGetCollection($oIE, 0) ; Get first form
$colInputs = _IETagNameGetCollection($oForm, "Input") ; Get collection of input tags
$iInputCnt = @extended
ConsoleWrite("Debug: There are " & $iInputCnt & " input tags" & @LF)
$n = 0
For $oInput In $colInputs
    ConsoleWrite("Debug: Index = " & $n & "  Type = " & $oInput.type & "  Name = " & $oInput.name & @LF)
    $n += 1
Next

; Close IE
_IEQuit($oIE)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If the site has a "nice anti-bot feature", what is its URL and why are we hacking it?

Hacking is the wrong term to be using. Hackng is an intentional attack to break into a system, unauthorized. You want to use the term AUTOMATE.

You can find several sites that use dynamic controls. I've used them on my sites for various reasons, normally for added security so someone can't mirror off my site. I've also used them cause the values were being dynamically pulled from a DB depending on various other data that formulated the results.


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

Well, I got a lot further along and then i came across this one line:

<input type=button value="login"  onclick="document.location='i.cfm?&l11d&f=sc_research2&rtype=4';">

No Name or ID, just the value of the button. I can't use _IEGetObjByName -or- _IEGetObjByID since those requirements don't exist. _IELinkClickByText doesn't work either.

Is there any such undocumented function _IEGetObjByValue???? That would be awesome. if not, I might look int the _IEGetObjByName and rewrite it to support VALUE instead and submit it???

Is there any way to automate a click on such a button if the VALUE is the only property assigned?


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

Well, I got a lot further along and then i came across this one line:

<input type=button value="login"  onclick="document.location='i.cfm?&l11d&f=sc_research2&rtype=4';">

No Name or ID, just the value of the button. I can't use _IEGetObjByName -or- _IEGetObjByID since those requirements don't exist. _IELinkClickByText doesn't work either.

Is there any such undocumented function _IEGetObjByValue???? That would be awesome. if not, I might look int the _IEGetObjByName and rewrite it to support VALUE instead and submit it???

Is there any way to automate a click on such a button if the VALUE is the only property assigned?

You didn't even read post #11, did you?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You didn't even read post #11, did you?

:)

I tested it and it's not helping me it appears. Yea I know the Index = 0 in this case but then what do I do with it? I'm looking at CONTROLCLICK and I am thinking that I need to use the [CLASS] feature? (i.e. [CLASS:Button; TEXT:Finish; INSTANCE:2] )???

I'm not quite sure what you are trying to get at unless it is a CLASS?

Sorry but I am just being thickheaded about this. I can't 'see' the light you are shining in my eyes yet :)


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

I tested it and it's not helping me it appears. Yea I know the Index = 0 in this case but then what do I do with it? I'm looking at CONTROLCLICK and I am thinking that I need to use the [CLASS] feature? (i.e. [CLASS:Button; TEXT:Finish; INSTANCE:2] )???

I'm not quite sure what you are trying to get at unless it is a CLASS?

Sorry but I am just being thickheaded about this. I can't 'see' the light you are shining in my eyes yet :)

You're not going to use Control* anything, you're going to use just the _IE funcs (_IELinkClickByIndex).

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

I tested it and it's not helping me it appears. Yea I know the Index = 0 in this case but then what do I do with it? I'm looking at CONTROLCLICK and I am thinking that I need to use the [CLASS] feature? (i.e. [CLASS:Button; TEXT:Finish; INSTANCE:2] )???

I'm not quite sure what you are trying to get at unless it is a CLASS?

Sorry but I am just being thickheaded about this. I can't 'see' the light you are shining in my eyes yet :)

The point was using _IETagNameGetCollection($oForm, "Input") to get the collection of "input" tags and then walking through them looking for $oInput.value = "WhateverYouAreLookingFor". Once you find that, you have the object to click on using _IEAction($oInput, "click") or some other _IE* function.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The point was using _IETagNameGetCollection($oForm, "Input") to get the collection of "input" tags and then walking through them looking for $oInput.value = "WhateverYouAreLookingFor". Once you find that, you have the object to click on using _IEAction($oInput, "click") or some other _IE* function.

:)

OMG THANK YOU ALL!!!

$oInputs = _IETagNameGetCollection ($oIE, "input")
$iInputCnt = @extended
$n = 0
        For $oInput In $oInputs
                $n += 1
                If $oInput.value = "Research"  Then
                            msgbox(0,"Index", $oInput)
                            _IEAction ($oInput, "click")
                            $Flag ="1"
                            ExitLoop
                endif
        Next

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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