Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

onClick - No name, no id :-(


  • This topic is locked This topic is locked
13 replies to this topic

#1 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 21 February 2012 - 08:45 PM

Ok, so this my HTML code:
<tbody><tr><br /> <td height="1px" id="topsurf"/><br /> </tr><br /> <tr><br /> <td align="center" valign="top"><b><font size="3" face="Tahoma" color="#FFFF00"><span id="count"><table cellspacing="0" cellpadding="2" border="0" id="table1"><tbody><tr><td><button onclick="wrong();" style="height: 20px; background-color: rgb(255, 0, 0); width: 20px;" name="B5" type="submit"/></td><td><button onclick="submitform(3);" style="height: 20px; background-color: rgb(255, 255, 0); width: 20px;" name="B5" type="submit"/></td></tr><tr><td><button onclick="wrong();" style="height: 20px; background-color: rgb(0, 0, 255); width: 20px;" name="B5" type="submit"/></td><td><button onclick="wrong();" style="height: 20px; background-color: rgb(0, 255, 0); width: 20px;" name="B5" type="submit"/></td></tr></tbody></table></span></font></b></td><br /> </tr><br /> </tbody>


I want inside my IE to be able to click the "submitform(3);" but I don't have anywhere to chose getElementBy? or getObjBy? Because there are other buttons which have the same name.. any advice?







#2 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 21 February 2012 - 09:34 PM

Can someone please help me please? This is the only thing I need for my prog.

#3 JLogan3o13

JLogan3o13

    115 and holding

  • MVPs
  • 4,425 posts

Posted 21 February 2012 - 09:36 PM

Hi, Tymo93, welcome to the forum. Please note that it is considered good manners to wait 24 hours before bumping your post; this gives us all a good chance to look over your problem and try to assist :)

As for your problem, can you provide us with the URL, please? We may be able to glean a way to assist with the page's full html.

Edited by JLogan3o13, 21 February 2012 - 09:36 PM.

If you put a million monkeys on a million keyboards, one of them will eventually write a Java program. The rest of them will write Perl programs.

 

My Scripts: SCCM UDFInclude Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, Windows Firewall UDF


#4 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 21 February 2012 - 09:51 PM

Thanks for reply! After research, I found this:
http://vasthits.com/surfbars/multisurfba...=0&s=&id=1&cat=&dir=&&cash=0

The actual link, and inside code is not even written in html, its pure java after you go down a bit. Maybe thats why it didn't work? :-?
Oh well, if it is that way, what command shall I use to get the Javascript button?

#5 AlmarM

AlmarM

    Programming my way.

  • Active Members
  • PipPipPipPipPipPip
  • 1,696 posts

Posted 21 February 2012 - 11:22 PM

Ok, so this my HTML code:

<tbody><tr><br /> <td height="1px" id="topsurf"/><br /> </tr><br /> <tr><br /> <td align="center" valign="top"><b><font size="3" face="Tahoma" color="#FFFF00"><span id="count"><table cellspacing="0" cellpadding="2" border="0" id="table1"><tbody><tr><td><button onclick="wrong();" style="height: 20px; background-color: rgb(255, 0, 0); width: 20px;" name="B5" type="submit"/></td><td><button onclick="submitform(3);" style="height: 20px; background-color: rgb(255, 255, 0); width: 20px;" name="B5" type="submit"/></td></tr><tr><td><button onclick="wrong();" style="height: 20px; background-color: rgb(0, 0, 255); width: 20px;" name="B5" type="submit"/></td><td><button onclick="wrong();" style="height: 20px; background-color: rgb(0, 255, 0); width: 20px;" name="B5" type="submit"/></td></tr></tbody></table></span></font></b></td><br /> </tr><br /> </tbody>


I want inside my IE to be able to click the "submitform(3);" but I don't have anywhere to chose getElementBy? or getObjBy? Because there are other buttons which have the same name.. any advice?

If you are trying to call the submitform(3) function in this sample, I think I might have an easy solution.
As far as I know you can call javascript functions trought the URL bar. You can simpely navigate to the following URL:
javascript:submitform(3);


Try it.
I'll see your reply tomorrow. Going to get some sleep now.

Gnite.

Edited by AlmarM, 21 February 2012 - 11:22 PM.

Minesweeper

A minesweeper game created in autoit, source available.

 

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

 

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.


#6 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 22 February 2012 - 04:48 PM

If you are trying to call the submitform(3) function in this sample, I think I might have an easy solution.
As far as I know you can call javascript functions trought the URL bar. You can simpely navigate to the following URL:

javascript:submitform(3);


Try it.
I'll see your reply tomorrow. Going to get some sleep now.

Gnite.

Yes, that might work, but I have single link with page where is another webpage/link in frameset/frame. So I need to re-attach it to that link where it contains the actual Javascript code. So I tested for frames presence using this:
#include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("<a href='http://vasthits.com/surf.php?sb=1&cash=1' class='bbc_url' title='External link' rel='nofollow external'>http://vasthits.com/surf.php?sb=1&cash=1"</a>) $oFrame = _IEFrameGetCollection($oIE, 0) If @error Then Exit MsgBox(0, "Frame Info", _IEPropertyGet($oFrame, "header"))


but it comes with 0 at Frame Info. any idea?

#7 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 22 February 2012 - 05:06 PM

Ok I got a bit further after I got the message error under the debug with "--> IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType"
I runned this code:
#include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("<a href='http://vasthits.com/surf.php?sb=1&cash=1' class='bbc_url' title='External link' rel='nofollow external'>http://vasthits.com/surf.php?sb=1&cash=1"</a>) $oFrame = _IEFrameGetCollection($oIE, 0) If @error Then Exit MsgBox(0, "Frame Info", _IEPropertyGet($oFrame, "height")) If IsObj($oFrame) Then     ConsoleWrite("Debug: $ex = object (" & ObjName($oFrame) & ")" & @LF) Else     ConsoleWrite("Debug: $ex is not an object" & @LF) EndIf


So I got this at the debug message: Debug: $ex = object (HTMLWindow2)
How do I set the object type now? :-?

#8 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,377 posts

Posted 22 February 2012 - 05:17 PM

Yes, that might work, but I have single link with page where is another webpage/link in frameset/frame. So I need to re-attach it to that link where it contains the actual Javascript code. So I tested for frames presence using this:


I'm reading that as broken english. My brain couldn't process any of that :)
“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

#9 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 22 February 2012 - 05:59 PM

I'm reading that as broken english. My brain couldn't process any of that :)

Yeah sorry, could not explain better but I already done it. I mean I found the frame that was under the frameset... anyway, Still need to know how to click on that javascript button. Source Code:
var button='';<br /> button+='<table border="0"id="table1"cellspacing="0"cellpadding="2"><tr><td>';<br /> button+='<button type="submit" name="B5"style="height: 20; background-color: #00FF00; width:20" onclick="wrong();"></button></td>';<br /> button+='<td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #FF0000; width:20" onclick="wrong();"></button></td>';<br /> button+='</tr><tr><td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #FFFF00; width:20" onclick="submitform(3);"></button></td>';<br /> button+='<td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #0000FF; width:20" onclick="wrong();"></button></td>';<br /> var button2='<button type="submit"  name="B6" style="height: 20; background-color: #FFFF00; width:20" disabled></button>';function incrCount(){<br /> window.status="Please Wait...";


The Button that needs to be clicked is submitform(3);. I have tried with navigate but nothing.. I will try with somethink else.

#10 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 22 February 2012 - 06:21 PM

Don't know what to do from here... this is the final code I have been trying:
#include <IE.au3> _IEErrorHandlerRegister() Global $oIE, $oFrame, $oTDs, $oButtons, $oButton, $oIE = _IECreate("<a href='http://vasthits.com/surf.php?sb=1&cash=&' class='bbc_url' title='External link' rel='nofollow external'>http://vasthits.com/surf.php?sb=1&cash=&"</a>) $oFrame = _IEFrameGetCollection($oIE, 0) Local $oFrame = _IEFrameGetObjByName($oIE, "header") Local $oTDs = _IETagNameGetCollection($oFrame, 'td') Local $oButtons = _IETagNameGetCollection($oTDs, 'button') sleep (20000) For $oButton In $oButtons     If $oButton.onClick = 'submitform(0);' Then         _IEAction($oButton, 'click')         ExitLoop     EndIf Next _IELoadWait($oIE)


--> IE.au3 V2.4-0 Error from function _IETagNameGetCollection, $_IEStatus_InvalidObjectType

Why it doesnt find the button in the table?

#11 JLogan3o13

JLogan3o13

    115 and holding

  • MVPs
  • 4,425 posts

Posted 22 February 2012 - 06:42 PM

Hi, Tymo93. Are you attempting to click on the submit button after entering credentials, or on a button after you've already logged in? The URL you have gives me an error that my session has timed out, which leads me to believe it is after you have authenticated to the site. Can you provide a screenshot of the site and button you're attempting to click?

If you put a million monkeys on a million keyboards, one of them will eventually write a Java program. The rest of them will write Perl programs.

 

My Scripts: SCCM UDFInclude Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, Windows Firewall UDF


#12 tymo93

tymo93

    Seeker

  • Banned (NOT IN USE)
  • 19 posts

Posted 22 February 2012 - 07:57 PM

Hi, Tymo93. Are you attempting to click on the submit button after entering credentials, or on a button after you've already logged in? The URL you have gives me an error that my session has timed out, which leads me to believe it is after you have authenticated to the site. Can you provide a screenshot of the site and button you're attempting to click?

Hmm, Yes, you may need to authenticated with the website. I don't think the image of the button really matters: Posted Image
When my mouse is over the button it does not show as clickable [a hand with the pointing finger] but if you click it works.
Also, I have access to the frame level for now, the button is nested in a table and tds. The last third post I made shows the HTML code of the button.

#13 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,018 posts

Posted 22 February 2012 - 08:12 PM

tymo93,

That link you provided leads to a log-in page for . Please read the Forum Rules - particularly the bit that says:

"Do not discuss any of the following:
[...]
This includes forum or site auto-login methods
" :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#14 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,018 posts

Posted 22 February 2012 - 08:34 PM

tymo93,

I was asked to re-read the thread as it was suggested that you were not trying to automate a log-in as your link suggested. I have done so and it does seem to be the case.

However what I see now is that you are trying to automate 4 buttons. I notice that the image of one which you showed above looks very much like one of the 4 buttons imaged in this thread - which is a CAPTCHA. And I locked that thread yesterday. So this thread remains locked too.

M23

Edit: And I have just seen your PM - what a pity you solved it.
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users