rahoolm

Automate IE webclient having Javascripts

13 posts in this topic

I have attached a gif file to let you know what i want.

I login to a webclient and then click on the button (shown as First Click) - menu appears.

Then I take my mouse cursor little down over the first menu item then a secondary menu appears.

From this menu I select Fourth option.

When I click on the Fourth Item - a pop up window appears.

In this pop up window, i fill the required fields and then click on the done button. Or press enter on keyboard.

Alt keys cannot be used to show the menu.

I can bring the First menu using a imgclick function in IE.au3.

But i am not able to click on the secondary menu.

Let me know if you need the avi file.

post-52640-12615766103752_thumb.gif

Share this post


Link to post
Share on other sites



Screen shots to not reveal the underlying code that needs to be interfaced.

Here is a defunct example (defunct because the website referenced no linger uses a dhtml menu) that shows how to use fireEvent to trigger a javascript menu:

_IENavigate($oIE, "http://www.dhtmlcentral.com")

$divs = _IETagNameGetCollection ($oIE, "div")

$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m2").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m3").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m4").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m5").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m6").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m7").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").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

Share this post


Link to post
Share on other sites

Thanks a lot Dale!!

Please help me further

The site http://www.dhtmlcentral.com is not accessible in my office.

Can you give me same example on any other site having such menus?

$divs.item("oM_m1").fireEvent("onmouseover")

what is "oM_m1" in the above line?

Do we have some more examples of fireEvent on this forum?

Regards,

Rahul

Share this post


Link to post
Share on other sites

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN"><META http-equiv="Content-Type" content="text/html; charset=utf-8">

<HTML><BODY><FORM name="navForm"><TABLE class="toolbar-row" cellSpacing="0" cellPadding="0" width="100%" border="0"><TBODY><TR><TD class="toolbar-container" width="80%"><DIV id="divToolbar"><DIV class="toolbar"><TABLE height="100%" cellSpacing="0" cellPadding="0" border="0"><TBODY><TR><TD class="text-button" title="Actions" noWrap itemID="emx530204667887.27996">Actions&nbsp;</TD></TR></TBODY></TABLE></DIV></DIV></TD></TR></TBODY></TABLE></FORM></BODY></HTML>

the above is the code for the First Click button Actions

Share this post


Link to post
Share on other sites

Code For the First Hover

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN"><META http-equiv="Content-Type" content="text/html; charset=utf-8"> <HTML><HEAD><STYLE> </STYLE></HEAD><BODY><DIV class="menu-layer" style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden"><DIV class="content" style="POSITION: relative"><TABLE cellSpacing="0" cellPadding="0" border="0"><TBODY><TR class="menu-item submenu" id="tremx863241374517.0704" menuIndex="0" menuUID="emx863241374517.0704"><TD class="menu-label"><DIV> P--------e </DIV></TD></TR></TBODY></TABLE></DIV></DIV></BODY></HTML>

Code For the second click

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN"><META http-equiv="Content-Type" content="text/html; charset=utf-8"> <HTML><BODY><DIV class="menu-layer" style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden"><DIV class="content" style="POSITION: relative"><TABLE cellSpacing="0" cellPadding="0" border="0"><TBODY><TR class="menu-item" id="trem-9.788" menuIndex="4" menuUID="em.788"><TD class="menu-label" style="BACKGROUND-IMAGE: url(../com----ages/------eate.gif); BACKGROUND-REPEAT: no-repeat"><DIV> Cr----r----t... </DIV></TD></TR></TBODY></TABLE></DIV></DIV></BODY></HTML>

I have not included the javascript code

Share this post


Link to post
Share on other sites

I want to take mouse over "Plne"

<DIV class=menu-layer style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden"><DIV class=upbutton></DIV>

<DIV class=downbutton></DIV>

<DIV class=content style="POSITION: relative">

<TABLE cellSpacing=0 cellPadding=0 border=0>

<TBODY>

<TR class="menu-item submenu" id=OOPPP85120.288 menuIndex="0" menuUID="OOOPP5120.288">

<TD class=menu-label>

<DIV>PLne</DIV></TD></TR>

<TR class="menu-item submenu" id=trOOOP21198143079.307212 menuIndex="1" menuUID="OOOPPP079.307212">

<TD class=menu-label>

<DIV>Vonf---n</DIV></TD></TR>

<TR class="menu-item submenu" id=OOOPP62379.5305 menuIndex="2" menuUID="OOPPP2379.5305">

<TD class=menu-label style="BACKGROUND-IMAGE: url(..//cohidehdie/eateM.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>En---pg</DIV></TD></TR>

<TR class="menu-item submenu" id=OOPPP83577148.8234 menuIndex="3" menuUID="OOOP7148.8234">

<TD class=menu-label>

<DIV>Lpy</DIV></TD></TR>

<TR class="menu-item submenu" id=OOPPP17397455.6564 menuIndex="4" menuUID="OOOP5.6564">

<TD class=menu-label>

<DIV>Rpts</DIV></TD></TR>

<TR class="menu-item submenu" id=OOO63365.9519 menuIndex="5" menuUID="OOOP365.9519">

<TD class=menu-label>

<DIV>Popm</DIV></TD></TR></TBODY></TABLE></DIV></DIV>

Then I want to click on "CR PR"

<DIV class=menu-layer style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden"><DIV class=upbutton></DIV>

<DIV class=downbutton></DIV>

<DIV class=content style="POSITION: relative">

<TABLE cellSpacing=0 cellPadding=0 border=0>

<TBODY>

<TR class=menu-item id=OOOO181.59054 menuIndex="0" menuUID="OOOO59181.59054">

<TD class=menu-label style="BACKGROUND-IMAGE: url(..//cohidehdie/eateate.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>Crr---ge...</DIV></TD></TR>

<TR id=OOO28555.2648 menuIndex="1" menuUID="OOOP302618028555.2648" menuType="undefined">

<TD class=menu-separator>

<DIV class=menu-separator style="HEIGHT: 2px">&nbsp;</DIV></TD></TR>

<TR class=menu-item id=OOOO484.7683 menuIndex="2" menuUID="OOO36246484.7683">

<TD class=menu-label style="BACKGROUND-IMAGE: url(../cohidehdie/eate.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>C---Rine...</DIV></TD></TR>

<TR class=menu-item id=OOOO038364.7754 menuIndex="3" menuUID="OOOP852048038364.7754">

<TD class=menu-label style="BACKGROUND-IMAGE: url(..//cohidehdie/eate.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>Cri...</DIV></TD></TR>

<TR class=menu-item id=oOOO1023818.709 menuIndex="4" menuUID="OOOP678271023818.709">

<TD class=menu-label style="BACKGROUND-IMAGE: url(..//cohidehdie/eate.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>CR--PR...</DIV></TD></TR>

<TR class=menu-item id=OOOP1042784647680.485 menuIndex="5" menuUID="OOOP1042784647680.485">

<TD class=menu-label style="BACKGROUND-IMAGE: url(..//cohidehdie/eatee.gif); BACKGROUND-REPEAT: no-repeat">

<DIV>CB...</DIV></TD></TR></TBODY></TABLE></DIV></DIV>

I am going on vacation..

You have complete code now.

I have changed names for IP protection.

Let me know your view.

Thanks in advance!!

Wish you a Merry Christmas (without any offence - if you do not celebrate it)!! :evil:

Take Care! ;)

--Rahul

Share this post


Link to post
Share on other sites

Hi Dale,

It will be really helpful to me if you can reply to the query made by rahoolm as I also have the same query.

Share this post


Link to post
Share on other sites

While I'm not a fan of reopening a thread after 5+ years (would be best to start a new topic and reference an existing one)...

This >library may have what you're looking for.

Keep in mind, that those menu's are probably dynamic, meaning they have no object reference until an event accesses them.

You could probably use:

_IEEx_JSMouseEventObj()

Or

_IEEx_ObjDispatchEvent()

To fire the necessary events, then access the menu's values or object reference.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Hi Smoke_n,

I am using IE8 in my machine. Is "_IEEx_JSMouseEventObj()" Or "_IEEx_ObjDispatchEvent()" will be working for me?

Thanks

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Those two should be fine, you'd use fireevent for the _ieex_objdispatchevent I believe though.

I believe there are example(s) in the the zip file you can run to see.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Hi SmOke_N,

I tried using _IEEx_JSMouseEventObj() and _IEEx_ObjDispatchEvent(), But it didn't worked for me.

I want to place my mouse pointer to the Engineering sub menu (as you can see in the screenshot) but it didn't worked. I am using the below code for it.

#include

#include

#include

#include

#include "IEEx.au3"

#include

#include

Local $oIE = _IECreate("http://myworkshop.health.ge.com",0,1,1,1)

WinWaitActive("MyWorkshop")

WinSetState("MyWorkshop","",@SW_MAXIMIZE)

_IEAction($oIE,"refresh")

WinWaitActive("MyWorkshop")

WinSetState("MyWorkshop","",@SW_MAXIMIZE)

_IELoadWait($oIE)

$oform = _IEFormGetObjByName($oIE,"navigatorForm")

$oTableDrop = _IETableGetCollection($oIE,26)

$oElemsDrop = _IETagNameGetCollection($oTableDrop, "td")

For $oElemDrop In $oElemsDrop ; loop over td tag collection

If ($oElemDrop.title == "Search" and $oElemDrop.className == "menu-arrow") Then ; if the title matches we have our target

$oCorrectDrop = $oElemDrop

ExitLoop

EndIf

Next

sleep(1000)

_IEAction ($oCorrectDrop, "click")

_IELoadWait($oIE)

sleep(1000)

$oTableEngg = _IETableGetCollection($oIE,8)

$oElemsEngg = _IETagNameGetCollection($oTableEngg, "div")

For $oElemEngg In $oElemsEngg

If $oElemEngg.innerText == "Engineering" Then

$oCorrectEngg = $oElemEngg

ExitLoop

EndIf

Next

_IEEx_ObjDispatchEvent($oform, $oCorrectEngg)

The HTML code for it

<DIV>Agreements Search</DIV></TD></TR>

<TR id=tremx77604501148.35541 class="menu-item submenu" menuIndex="4" menuUID="emx77604501148.35541">

<TD class=menu-label>

<DIV>Commercial</DIV></TD></TR>

<TR id=tremx470924331591.5276 class="menu-item submenu" menuIndex="5" menuUID="emx470924331591.5276">

<TD class=menu-label>

<DIV>Document</DIV></TD></TR>

<TR id=tremx445732535037.089 class="menu-item submenu" menuIndex="6" menuUID="emx445732535037.089">

<TD class=menu-label>

<DIV>Engineering</DIV></TD></TR>

<TR id=tremx1147558251617.455 class="menu-item submenu" menuIndex="7" menuUID="emx1147558251617.455">

<TD class=menu-label>

<DIV>TechPub Search</DIV></TD></TR></TBODY></TABLE></DIV></DIV>

<DIV style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden" class=menu-layer>

<DIV class=upbutton></DIV>

<DIV class=downbutton></DIV>

<DIV style="Z-INDEX: 0; POSITION: relative" class=content>

<TABLE border=0 cellSpacing=0 cellPadding=0>

<TBODY>

<TR id=tremx1263647610635.5605 class=menu-item menuIndex="0" menuUID="emx1263647610635.5605">

<TD class=menu-label>

<DIV>eNPI...</DIV></TD></TR></TBODY></TABLE></DIV></DIV>

<DIV style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden" class=menu-layer>

<DIV class=upbutton></DIV>

<DIV class=downbutton></DIV>

<DIV style="Z-INDEX: 0; POSITION: relative" class=content>

<TABLE border=0 cellSpacing=0 cellPadding=0>

<TBODY>

<TR id=tremx324514590000.76904 class=menu-item menuIndex="0" menuUID="emx324514590000.76904">

<TD style="BACKGROUND-IMAGE: url(../common/images/GEMS.gif); BACKGROUND-REPEAT: no-repeat" class=menu-label>

<DIV>My Workshop...</DIV></TD></TR>

<TR id=tremx281350373051.9494 class=menu-item menuIndex="1" menuUID="emx281350373051.9494">

<TD class=menu-label>

<DIV>Tech Pub...</DIV></TD></TR>

<TR id=tremx78098888000.8602 class=menu-item menuIndex="2" menuUID="emx78098888000.8602">

<TD class=menu-label>

<DIV>Research Agreement...</DIV></TD></TR></TBODY></TABLE></DIV></DIV>

<DIV style="Z-INDEX: 5; VISIBILITY: hidden; OVERFLOW: hidden" class=menu-layer>

<DIV class=upbutton></DIV>

<DIV class=downbutton></DIV>

<DIV style="Z-INDEX: 0; POSITION: relative" class=content>

<TABLE border=0 cellSpacing=0 cellPadding=0>

Kindly help

post-90230-47122_thumb.png

Share this post


Link to post
Share on other sites

This is the screenshot of the page showing the sub menu "Engineering" I want to select.

post-90230-0-00986200-1424781901_thumb.p

Share this post


Link to post
Share on other sites

rakesh3235,

Start your own topic, reference this thread.

I personally won't help anyone any longer with websites I can't actually use to debug the issue.

But your call to _IEEx_ObjDispatchEvent is wrong.

_IEEx_ObjDispatchEvent($oCorrectEngg, "click")

 

Should always do checks IsObj() in my opinion after object creation/validation.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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