Jump to content

Automated click inside a web page javascript


Recommended Posts

here is the source for the button from the web page using DeBugBar ..

ive been trying to figure out how to make this button refresh every 10 seconds without it using the mouse the name of the button is Refresh.

<A style="COLOR: #fff; TEXT-DECORATION: underline" href="javascript:Site.deleteCache();Site.reload()">Refresh</A>

hope someone can help me with this thanks

Edited by apollopimp
Link to comment
Share on other sites

_IELinkClickByText

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

Link to comment
Share on other sites

_IELinkClickByText

how would i use that

i have no clue what i am doing i have tried many different things here is one

#include <IE.au3>

$oIE = _IEAttach ("Demon Slayer by Chris on MySpace Apps", "embedded")

_IELinkClickByText ($oIE, "Refresh")

how would i attach to my page and than use _IELinkClickByText to find the Refresh and click on it?

Link to comment
Share on other sites

You show the code you tried (good), but don't describe the results - including messages in the SciTe console (bad).

You mention Frames, so you may need to look at _IEFrameGet* functions.

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

Link to comment
Share on other sites

I guess that it's sufficient to do something like:

$oIE.document.parentwindow.eval('Site.deleteCache();Site.reload();')

or just navigating to this javascript:

_IENavigate($oIE, 'javascript: Site.deleteCache();Site.reload();')

For example:

#include <IE.au3>

Global $oIE = _IECreate()
Global $sHTML = _GenHTML()
_IEDocWriteHTML($oIE, $sHTML)

$oIE.document.parentwindow.eval("myFunc();myFunc();")

While _IEPropertyGet($oIE, 'visible')
    Sleep(20)
WEnd
Exit

Func _GenHTML()
    Local $s_HTML = ""
    
    $s_HTML &= "<HTML>" & @CRLF
    $s_HTML &= "<HEAD></HEAD>" & @CRLF
    $s_HTML &= "<BODY><INPUT TYPE=button VALUE='Test' onclick='javascript: myFunc()'>" & @CRLF
    $s_HTML &= "<script TYPE='text/javascript'>" & @CRLF
    $s_HTML &= "function myFunc(){" & @CRLF
    $s_HTML &= "alert('Test');" & @CRLF
    $s_HTML &= "}" & @CRLF
    $s_HTML &= "</SCRIPT>" & @CRLF
    $s_HTML &= "</BODY>" & @CRLF
    $s_HTML &= "</HTML>"

    Return $s_HTML
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

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