Sign in to follow this  
Followers 0
lespoils

interact with action button on web page

7 posts in this topic

Hi, i have the folowing problem. i want to be able to use the button on a web page (html code in the end) with the _IEaction() function. but i can't, any help is welcome. usually i use the _IEFormGetCollection and _IEFormElementGetCollection() but there is no form in this page.

i'm not very good in html but i think it's running a script to manage the button click. also i found this line:

<div style="text-align:center;margin:4px;" id="fight_btns"></div>

wich is probably the button i want, i tried with _IEGetObjectById function but i didnt get anything.

As i said any help is more than welcome. all i want to do is to use the _IEAction() on the button.

Thanks and the html code follows

Lespoils

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Pet Me</title>

<link rel="shortcut icon" href="/favicon.ico" />

<link rel="stylesheet" href="/facebook/pet/css/pet.css?10" type="text/css" /><script type='text/javascript' src='/facebook/pet/js/ufo.

js?10'></script><script type='text/javascript' src='/facebook/pet/js/moo.js?10'></script><script type='text/javascript' src='/facebook/

pet/js/pet.js?10'></script><script type='text/javascript' src='/facebook/pet/js/fight.js?10'></script></head>

<body>

<div id="nav">

</div>

<div class="nav-status">

<span style="float:left;">Currently playing with: <a href="http://neo2.hotornot.com/facebook/pet/showpet?pid=597349&fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user=563071092&fb_sig_profile_update_time=1183685517

&fb_sig_session_key=657ab495b400e392aa3d47c9-771e&fb_sig_added=1&fb_sig=685974e8673780f0793f4dff746d6d1f&cpid=5973

49&msg="><b>PetFace</b></a></span>

<span style="float:right;">Location: <a href="http://neo2.hotornot.com/facebook/pet/askfight?loc=3&fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user=563071092&fb_sig_profile_update_time=1183685517&fb_

sig_session_key=657ab495b400e392aa3d47c9-c73d766279a46f0aaac1d104771e&fb_sig_added=1&fb_sig=685974e8673780f0793f

4dff746d6d1f&cpid=597349&msg="><b>Greenwich Forest</b></a></span>

<p style="clear:both;" />

</div>

<div id="the_msg" style="height:30px;"></div>

<table>

<tr>

<td>

<div id="enemy_lifebar"></div>

</td>

<td valign="top">

<img src="http://pix.hotornot.com/img/facebook/pet/monsters/crop/crop_monster3.png"/>

<div class="pet-avatar-class">

Level 17 Ant </div>

</td>

<td valign="top">

<div class="pet-avatar-no-border">

<script type="text/javascript">

var FO = { movie:"http://neo2.hotornot.com/facebook/pet/swf/pet2.swf?10", width:"250", height:"250", majorversion:"8", build:"0", flashvars:"host=http://pix.hotornot.com/img/facebook/pet&pet=5&face=182&armor=5&foot=225&hand=10&weapon=45" };

UFO.create(FO, "avatar509274");

</script><div id="avatar509274" style="width:250px;height:250px;"></div> <div class="pet-avatar-name">

PetFace </div>

<div class="pet-avatar-class">

Level 19 Purpabit </div>

</td>

<td>

<div id="pet_lifebar"></div>

</td>

</tr>

<tr>

<td></td>

<td>

<div id="enemy_stats"></div>

</td>

<td>

<div id="pet_stats"></div>

</td>

<td></td>

</tr>

</table>

<div style="text-align:center;margin:4px;" id="fight_btns"></div>

<script type="text/javascript">

var FIGHT = {

'id' : 47973843,

'turn' : 0,

'enemy' : {

'name' : 'Ant',

'level' : 17,

'cur_hp' : 4298,

'hp' : 4298,

'min_damage' : 208,

'max_damage' : 312,

'armor' : 52},

'pet' : {

'cur_hp' : 4109,

'hp' : 4190,

'min_damage' : 368,

'max_damage' : 554,

'armor' : 224}

};

var life0img = "http://pix.hotornot.com/img/facebook/pet/life0.gif";

var life1img = "http://pix.hotornot.com/img/facebook/pet/life1.gif";

var life2img = "http://pix.hotornot.com/img/facebook/pet/life2.gif";

var FORM_ACTION = "http://neo2.hotornot.com/facebook/pet/?fb_sig_in_iframe=1&fb_sig_time=1183690011.9784&fb_sig_user

=563071092&fb_sig_profile_update_time=1183685517&fb_ig_session_key=657ab495b400e392aa3d47c9-ded=1&fb_sig=68597

4e8673780f0793f4dff746d6d1f&cpid=597349&msg=";

renderFight();

renderMsg("");

</script>

<br /><br />

</div>

</body>

</html>

Share this post


Link to post
Share on other sites



Please show your AutoIt code and the output sat to the SciTe console.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Hi

okay different problem same issue. i want to click on a picture in a web page, but it's a flash component.

when i right click on it, i can go to "about adobe flash player 9 ...". so it's flash no doubt.

here's my autoit code:

;this is the function i want to use to do the click
func bug()
    $oIE = _IEAttach ("Pet me")
    _IELoadWait ($oIE)
    $sText = _IEPropertyGet($oIE,"innertext")   
    
    $oForms = _IEFormGetCollection ($oIE)   
    $oElement = _IEFormElementGetCollection($oForms)

    For $oElement In $oElements
        MsgBox(0, "Img Info", "src=" & $oElement.type)
        ;_IEAction($oElement,"click")
        ;_IELoadWait ($oIE)
    Next
EndFunc

here's the html:

CODE
<p style="clear:both;" />

<div style="margin:10px;float:left;">

<div class="pet-avatar">

<script type="text/javascript">

var FO = { movie:"http://neo2.hotornot.com/facebook/pet/swf/pet2.swf?10", width:"250", height:"250", majorversion:"8", build:"0",

flashvars:"host=http://pix.hotornot.com/img/facebook/pet&pet=5&face=197&armor=274&foot=240&hand=196&weapon=198&link=http%3A%2F%

2Fneo2.hotornot.com%2Ffacebook%2Fpet%2Fshowpet%3Fpid%3D597349%26fb_sig_in_iframe%3D1%26fb_sig_time%3D1183944514.8481%

26fb_sig_user%3D563071092%26fb_sig_profile_update_time%3D1183685517%26fb_sig_session_key%3D657ab495b400e392aa3d47c9-563071092%

26fb_sig_expires%3D0%26fb_sig_api_key%3D692cc73d766279a46f0aaac1d104771e%26fb_sig_added%3D1%26fb_sig%

3Dcb47669511e11ea010e7a534aef3f85e%26cpid%3D%26msg%3D" };

UFO.create(FO, "avatar427014");

</script>

<div id="avatar427014" style="width:250px;height:250px;"></div>

<div class="pet-avatar-name">PetFace</div>

<div class="pet-avatar-class">Level 23 Purpabit</div>

</div>

Again thanks for the help, all i want is to be able to click with the IEAction() command on the component.

Lespoils

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

should be this

$oElements = _IEFormElementGetCollection($oForms)

    For $oElement In $oElements
        MsgBox(0, "Img Info", "src=" & $oElement.type)
        ;_IEAction($oElement,"click")
        ;_IELoadWait ($oIE)
    Next
EndFunc

You forgot the $oElements for the _IEFormElementGetCollection($oForms), only a quick glance didn't bother looking at anything else but it looks good :whistle:

Edited by Thatsgreat2345

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@tg is right about the $oElements, but if it is a flash object why are you bothering with a form element collection?

Also, the source you show is Javascript rather than HTML source. There is likely some dynamic page generation happening so you should either look at some of the tools in my sig to investigate the source or use _IEBodyReadHTML

The element you will want to interact with will be either an APPLET or an OBJECT.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Thanks guys

You are right Dale this only the part of the Html i though interresting. I will into the tools in your sig tonight, i'm presently at work. I think my main difficulty is since all the element in the html have no name tag associated to them, i have to find some workaround to target only the one i want. But again i'll look into this tonight.

Thanks to both of you guys :whistle:

Lespoils

Share this post


Link to post
Share on other sites

take a look at _IETagNameGetCollection


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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