Sign in to follow this  
Followers 0
prasingh

Urgent Help

15 posts in this topic

I am struggling to find one button control on toolbar control on my internet page. Can anyone please help?

even when I use the following code,

$sHTML = _IEDocReadHTML ($oIE)

_FileWriteLog(@ScriptDir & "\my.log",$sHTML)

I could not see the reference to the toolbar at all in the code. The page is a multiple HTML script. Is this the reason I am not able to do anything with the button??

Cheers


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites



to elaborate it further...

I used these lines of code on the top:-

$oIE = _IECreate()

_IENavigate($oIE, "http://****/businessobjects/enterprise115/InfoView/logon.aspx",0)

Now when I am done with validation on the login page, i want to click on the log off image (control button on the toolbar), I cannot get the reference to it even looping through the control.

Frustrating!!!

I dont want to use TAB key stroke to achieve this.. it will be surely poor programming.


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

Most likely there are Frames or iFrames involved. See _IEFrame* functions.

I suggest you use the free DebugBar (see my sig) to help you disect the page structure.

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

; Open a new browser script

$oIE = _IECreate()

_IENavigate($oIE, "http://**********/businessobjects/enterprise115/InfoView/logon.aspx",0)

;Log in script

$oForm = _IEFormGetObjByName ($oIE, "Form1")

$oQuery = _IEFormElementGetObjByName ($oForm, "MainLogon:_ctl2")

_IEFormElementSetValue ($oQuery, "***********")

$oQuery = _IEFormElementGetObjByName ($oForm, "MainLogon:_ctl4")

_IEFormElementSetValue ($oQuery, "****")

$oButton = _IEFormElementGetObjByName ($oForm, "MainLogon:LogonButton")

_IEAction ($oButton,"focus")

send("{ENTER}")

_IELoadWait($oIE)

;Checking the frames

$oFrames = _IEFrameGetCollection ($oIE)

$iNumFrames = @extended

For $i = 0 to ($iNumFrames - 1)

$oFrame = _IEFrameGetCollection ($oIE, $i)

Next

MsgBox(1,"Return",$oFrame)

It is returning me null.

Am I doing something wrong? Because this new page I am on consists of one main doc and the remaining frames. I have to identify one frame and click on the log off button. How do I do this?


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

_IEPropertyGet ($oFrame, "innerhtml")

I am using this to get the html and it does show that it is able to find the "Log Off" button. But now the question is how to reference it and click it?????


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

Thaks so much. Seems to be a good idea... why did it not come in my mind. Yeah!!!! let me check.

But still if you can tell me how to reference the button and click it, it will be useful as I have to do such sort of things on many other web pages. I am lovin AutoIT though and this forum. :-)


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

http://*******/businessobjects/enterprise115/InfoView/logon.aspx?action=logoff&done=1

Should I term this as aspx page or an action that has been done on the page to retrun it to the log on page. The log off page is actually returning back to the log off page.

So I would still need to identify the log off button and click it. Help Please.....


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Some questions: Have you started using DebugBar? What messages are being sent to the SciTe console when you run your code? You say you can see the source for the logoff button... what is it contained in (main document? frame? iFrame? how do you get to it?)? what is the HTML for the button?

Also suggest you add _IEErrorHandlerRegister() to your code to get more information to the console about any COM errors.

Dale

p.s. Please enclose your code in {code}{/code} or {autoit}{/autoit} blocks (replace { with [ ) . Also, please use a descriptive topic title when you post.

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

Answers to your questions:-

First - Yes

Second - I dont know about SciTe console

Third - Frame (I saved this in a flat file - _IEPropertyGet ($oFrame, "innerhtml"))

Fourth -

toolbarCtrl.add(lblSpacer);

toolbarCtrl.add (newIconWidget("btnLogoff","images/logout.gif",onBtnLogoffClick,null,"Log off",16,16,3,3,25,3));


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

SciTe is the code editor that comes with AutoIt. Please run your code from it (Tools -> Go or F5) - you are cheating yourself, particularly with IE.au3, if you don't. IE.au3 writes a lot of helpful messages to the SciTe console.

The "source" you post for the button is not the source of the button. It is Javascript that may create the button. You have more searching to do.

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

Oh!!!! I got it... you were talking about the SciTe editor. Yes, I am running it from the editor only sir. But the console does not show any message, it only shows successful completion on compiling and when I run it, it finishes without anything there.

toolbarCtrl.add(lblSpacer);

toolbarCtrl.add (newIconWidget("btnLogoff","images/logout.gif",onBtnLogoffClick,null,"Log off",16,16,3,3,25,3));

function onBtnLogoffClick()

{

parent.document.location = "logon.aspx?action=logoff&done=1";

}

Now I think the script is sufficient.


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

You may want to try running the script interpretted instead of compiled for testing...

Now I think the script is sufficient.

Not sure what you mean by that... are you all set now?

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

NO!!!!

I meant by "Now I think the script is sufficient." that I hope the lines of code were sufficient for the log off button for you to interprate.

Dale, I am approaching the delivery date of this script and still I have not reached anywhere. Its my hard luck.

How will I be able to interprate the code??

Secondly, can you please guide me how to actually reference the button on the toolbar on this particular page?


A smile costs nothing!!!! :-)

Share this post


Link to post
Share on other sites

Again, toolbarCtrl.add(lblSpacer); and related code is not your button. It is Javascript that manipulates the DOM. You need to find the interpretted HTML that makes up the button. DebugBar should help you wit this... drag the bullseye onto the control.

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

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