Sign in to follow this  
Followers 0
dushkin

Accessing javascript button

7 posts in this topic

Hi All,

I need to press a button in a web site which is built with java script, yahoo framework, CSS and Ajax.

The button is definitely not a simple html button.

Using the IE8 developer tools "Find control" facility I got the to the following line in the, probably, server code created line:

<td title="Raise Hand" class="toolbarButtonEmoticon13" id="IDS_WEBUI_BTN_RHAND" noWrap="nowrap" style="cursor: default; disabled: false;" onmouseover="OmBtnMouseOverEmoticon(this, document.getElementById('idEmoticonList'))" onmouseout="OmBtnMouseOutEmoticon(this, document.getElementById('idEmoticonList'))" onclick="g_oWPUIManager.oWPUIToolbarManager.onEmoticon(g_WPDefines.EMOTICON_BUTTON_ID)" enableState="13" state="13">

I tried to get the button object using many ways:

_IE_GetObjByID, IE_GetObjByName, using the title, using the id, but I always got 0.

I even tried _IEImgClick since there is an image on the button.

Any help will be appreciated.

Thanks!

Share this post


Link to post
Share on other sites



What is the full path to that TD tag? Is it inside a form, nested forms? In a frame? If you tried something like this:

$oRaiseHand = _IEFormElementGetObjByName($oForm, "IDS_WEBUI_BTN_RHAND")

What did you use for $oForm and how did you get it?

Add _IEErrorHandlerRegister() and run it in SciTE to see the errors. If that page is loaded in a frame from another site, you see ACCESS DENIED due to cross-site scripting protection.

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am really exhausted...

I am attaching part of the HTML which is generated on the server.

There is no form in the page.

I need to click on the button with the title "RAISE_HAND" . It is inside the first td.

I hope you can help me.

Thanks!

post-56238-12798047548299_thumb.jpg

Edited by dushkin

Share this post


Link to post
Share on other sites

OK, there's no form. But you think the iFrame, FrameSet, Frame, relationship might be significant? :blink:

You only posted a sliver of the source, so most of the ID attributes were not shown, but you have to:

1. Get the iFrame with $oIFrame = _IEFrameGetObjByName($oIE, "<put iFrame id here>")

2. Get the FrameSet under that with $oFrameset = _IEFrameGetObjByName($oIFrame, "<put frameset id here>")

3. Get the frame you want with $oFrame = _IEFrameGetObjByName($oFrameset, "frWP")

4. Now you can get the element you want with $oRaiseHand = _IEGetObjByName($oFrame, "IDS_WEBUI_BTN_RHAND")

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

OK, there's no form. But you think the iFrame, FrameSet, Frame, relationship might be significant? :blink:

You only posted a sliver of the source, so most of the ID attributes were not shown, but you have to:

1. Get the iFrame with $oIFrame = _IEFrameGetObjByName($oIE, "<put iFrame id here>")

2. Get the FrameSet under that with $oFrameset = _IEFrameGetObjByName($oIFrame, "<put frameset id here>")

3. Get the frame you want with $oFrame = _IEFrameGetObjByName($oFrameset, "frWP")

4. Now you can get the element you want with $oRaiseHand = _IEGetObjByName($oFrame, "IDS_WEBUI_BTN_RHAND")

;)

Dear Psalty,

The general method you offered was the one I was thinking about.

The problem is that I don't have an id or name attribute to the frameset and hence I am stuck. I do have for example onload, or others as you can see.

Is there another way?

Many thanks!

Share this post


Link to post
Share on other sites

You don't need a name. Use the 0-based index. For example, the first frameset (or frame) under $oIFrame would be _IEFrameGetCollection($oIFrame, 0).

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thanks! It helped!

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