Sign in to follow this  
Followers 0

onClick - No name, no id :-(

14 posts in this topic

Posted

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?

Share this post


Link to post
Share on other sites



Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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?

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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?

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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?

Share this post


Link to post
Share on other sites

Posted

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?

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0