Jump to content

onClick - No name, no id :-(


tymo93
 Share

Recommended Posts

Ok, so this my HTML code:

<tbody><tr>
<td height="1px" id="topsurf"/>
</tr>
<tr>
<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>
</tr>
</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?

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Ok, so this my HTML code:

<tbody><tr>
<td height="1px" id="topsurf"/>
</tr>
<tr>
<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>
</tr>
</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

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.

Link to comment
Share on other sites

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("http://vasthits.com/surf.php?sb=1&cash=1")
$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?

Link to comment
Share on other sites

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("http://vasthits.com/surf.php?sb=1&cash=1")
$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? :-?

Link to comment
Share on other sites

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 :)

Spoiler

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

 

Link to comment
Share on other sites

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='';
button+='<table border="0"id="table1"cellspacing="0"cellpadding="2"><tr><td>';
button+='<button type="submit" name="B5"style="height: 20; background-color: #00FF00; width:20" onclick="wrong();"></button></td>';
button+='<td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #FF0000; width:20" onclick="wrong();"></button></td>';
button+='</tr><tr><td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #FFFF00; width:20" onclick="submitform(3);"></button></td>';
button+='<td>';button+='<button type="submit" name="B5"style="height: 20; background-color: #0000FF; width:20" onclick="wrong();"></button></td>';
var button2='<button type="submit"  name="B6" style="height: 20; background-color: #FFFF00; width:20" disabled></button>';function incrCount(){
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.

Link to comment
Share on other sites

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("http://vasthits.com/surf.php?sb=1&cash=&")
$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?

Link to comment
Share on other sites

  • Moderators

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?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

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.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...