Jump to content

Trouble clicking javascript link (IE.au3)


 Share

Recommended Posts

Here is the source on the web page:

<a href="javascript:wsMenu_jumpUrl('../../websys/webArch/jobList.cgi',000)" id="MENU_JOB" class="defaultTableButton">Job</a>

I tried using the _IELinkClickByText function:

_IELinkClickByText($oIE, "Job")

But it isn't a link.

I have tried using _IEGetObjByName with _IEAction "click" with "Job" or "MENU_JOB." But that didn't work.

Can somebody tell me the trick to clicking on buttons that are not true links?

Thanks

Link to comment
Share on other sites

Here is the source on the web page:

<a href="javascript:wsMenu_jumpUrl('../../websys/webArch/jobList.cgi',000)" id="MENU_JOB" class="defaultTableButton">Job</a>

I tried using the _IELinkClickByText function:

_IELinkClickByText($oIE, "Job")

But it isn't a link.

I have tried using _IEGetObjByName with _IEAction "click" with "Job" or "MENU_JOB." But that didn't work.

Can somebody tell me the trick to clicking on buttons that are not true links?

Thanks

$clickme = _IEGetObjByName($oIE, 'MENU_JOB')
_IEAction($clickme, 'click')

try that, should work.

Link to comment
Share on other sites

KingNED,

Unfortunately that didn't work. I had tried that previously (with different variable names and double quotes instead of single quotes) with no luck.

I should mention that the device hosting the web pages is a copier/scanner/fax/printer. My goal is to grab certain log data off of it automatically. There is no API, secure shell, FTP or other option at this point to access the data, although I have requests in with the vendor. For now AutoIT seems like the best solution.

The web page has two frames, a header and body. The button I want to click is in the body. Do I have to somehow move the focus to the second frame before I execute the code? If so, how does one set the active frame?

Thanks

Link to comment
Share on other sites

Juvigy,

I have tried your code:

; Create a browser window and navigate to copier Job menu

$oIE = _IECreate()

_IENavigate($oIE, "http://hostname/web/guest/en/websys/webArch/mainFrame.cgi")

_IENavigate($oIE,"javascript:wsMenu_jumpUrl('../../websys/webArch/jobList.cgi',000)")

But it didn't work.

header.htm

Link to comment
Share on other sites

I think I was grabbing at straws when I asked if I had to somehow move the focus from the header frame to the body frame. Just to test things out, I have tried to click on a button in the header. I choose the HELP button (how appropriate).

I have tried:

$oIE = _IECreate()

_IENavigate($oIE, "http://hostname/web/guest/en/websys/webArch/mainFrame.cgi")

$clickme = _IEGetObjByName($oIE, "Help")

_IEAction($clickme, 'click')

and...

$oIE = _IECreate()

_IENavigate($oIE, "http://hostname/web/guest/en/websys/webArch/mainFrame.cgi")

$clickme = _IEGetObjByName($oIE, "helpBtn")

_IEAction($clickme, 'click')

to no avail...

That seems to eliminate frames as now I am trying a button in the first frame rather than my ultimate goal, which is to click a button in the second frame. Any other suggestions or clarification needed?

Link to comment
Share on other sites

<a href="javascript:wsMenu_jumpUrl('../../websys/webArch/jobList.cgi',000)" id="MENU_JOB" class="defaultTableButton">Job</a>

It is a link, it is just styled as a button.

To make sure you have the link selected, try

$oLink = _IEGetObjByName($oIE, "MENU_JOB")

_IEPropertySet($oLink, "innertext", "BANG!")

If the link text changes, you have the right one

If you have the right one, there there may be other events required besides the click... for example

$oLink.fireEvent("onmouseover")

_IEAction($oLink, "click")

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

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