Sign in to follow this  
Followers 0
nbala75

How to identify a new page in IE

11 posts in this topic

There are certain fields which i fill in a particular page using IE as browser

When i press Submit button, browser shows a new page and i need to press confirm button to complete the transaction.

There are no new windows opened, the windows title are pretty identical. I cannot differentiate the new page using Visible/hidden texts. There is no change at all.

How do i identify this new CONFIRM page? Bcos i need to wait till the new page loads and then click confirm button, which takes some few seconds. How do i use WINWAITACTIVE function without identifying the new page?

Is there any other way?

Share this post


Link to post
Share on other sites



Use _IELoadWait from IE.au3. Or you can differentiate the windows with _IEBodyReadHTML. Just loop this function until the string returned has changed.

I think you do not use the IE.au3 at all! You should use it!


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Funkey

u are right...iam shy to use IE.au3

Couple of weeks back, i was just trying to learn using IE. I first cud manage to get my Login, password thing working using IEcreate of IE.au3. Once after that, I had tried to use it on existing windows (which were opened earlier). Somehow after some couple of hrs of effort, i cud not manage to do it even for once :x. I used IEnavigate, IEAttach etc, but cud not make it to work. It wasnt attaching at all.

As iam a novice, i felt miserable that day and left it as it is :P

Since i work mainly on IE, getting to know IE.au3 will really help to a great deal

Even yesterday, i was searching for online videos for IE scripts with simple examples...i cud not find any.

If u can help me with couple of good links to learn scripts using IE.au3, that wud be really great

Thanx again for ur time

Edited by nbala75

Share this post


Link to post
Share on other sites

The thing about the IE.au3 UDF is that there are multiple "advanced" topics involved: COM Objects, and the IE DOM. It is a lot to learn, but well worth it, and you don't have to be a full expert on either. You just need some basics in each.

Take it one step at a time. First you need an object reference to the instance of IE (the $oIE object). You get it directly from _IECreate(), or retrieve it from an existing instance with _IEAttach(). Since you had trouble with _IEAttach(), what did you try? Post a short example of how you used _IEAttach() and how it failed for you. For example, which "mode" of _IEAttach() were you trying to match with?

:x


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

PSaltyDS

Thanx for ur time

This is the one which worked for me :x

#include <IE.au3>
; Create a browser window and navigate to 
$oIE = _IECreate("https://trade.justtrade.in/stsb/presentationlayer/Login.ASP")
$oForms = _IEFormGetCollection ($oIE)
For $oForm In $oForms
$o_form = $oForm
Next

; get pointers to the login form and username, password and signin fields
$o_login = _IEFormElementGetObjByName ($o_form, "LoginID")
$o_password = _IEFormElementGetObjByName ($o_form, "Password")
$o_tpassword = _IEFormElementGetObjByName ($o_form, "TradePassword")
$o_signin = _IEFormElementGetObjByName ($o_form, "Submit")

$username = "1234567"
$password = "oooooooo"
$tpassword = "oooooooo"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEFormElementSetValue ($o_tpassword, $tpassword)
_IEFormElementRadioSelect ($oForm, "ASP^8", "Product", 1, "byValue")
_IEAction ($o_signin, "click")

This is the one which i tried using it once after loging in, which never worked...didnt know what to do after that...i have been searching, reading, trying it out etc..but none worked

$oIE1 = _IEAttach("N")
Sleep(1000)
$formname="PlaceOrder"

$o_form1 = _IEFormGetObjByName ($oIE1, $formname)
$o_symbol = _IEFormElementGetObjByName ($o_form1, "Symbol")
$o_Submit = _IEFormElementGetObjByName ($o_form1,"Submit Order")
_IEAction ($o_Submit, "click")

$oIE = _IEAttach ("<Title of the window>")
$o_form = _IEFormGetObjByName ($oIE, "<Form name>")
$Exch = _IEFormElementGetObjByName ($o_form, "Exchange")

$E="NSE"

_IEFormElementOptionselect($Exch,$E)

Even the above Login code which worked with IEcreate, never worked with IEattach :P. There were many other codes with which i have been trying to attach or navigate, were either ower-written or deleted :shifty:

Mine is always need based reading...there are so many needs with IE...but when i cud not even login(the very first step), its heartening to move further.

Anyways, if u cud suggest me some organised reading, some links for online videos, tutorials, examples etc, that wud really help me in my life. There were some 20 serially numbered YT videos, done by a lady into basics of autoit, but, none on IE :nuke:

Share this post


Link to post
Share on other sites

When i use this code, it shows the URL correctly, meaning that it has been attached properly (?)

#include <IE.au3>
$oIE = _IEAttach ("<title string>","Title")
MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))
Exit

When i use this code, it throws up error which is appended just below the code.

#include <IE.au3>
$oIE = _IEAttach ("<title string>","Title")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms - 1
    $oForm = _IEFormGetCollection ($oIE, $i)
    MsgBox(0, "Form Info", $oForm.name)
Next

Posted Image

Although Debugbar show some 4 forms in the page

Posted Image

What cud be the issue here?

Share this post


Link to post
Share on other sites

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

_IEAttach() failed in your second try. Since the first two lines of both scripts are the same, that means the IE page was NOT similarly available to both scripts. Stop right there and find out why the second script failed at _IEAttach(). Nothing after that could possibly work because $oIE was invalid.

:x


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

#8 ·  Posted (edited)

_IEAttach() failed in your second try. Since the first two lines of both scripts are the same, that means the IE page was NOT similarly available to both scripts. Stop right there and find out why the second script failed at _IEAttach(). Nothing after that could possibly work because $oIE was invalid.

:x

I was hoping that u wud come here and reply...thanx

But any suggestions? I have been trying with other modes as well without much help....where to look?

Edited by nbala75

Share this post


Link to post
Share on other sites

I don't know how you can move on until we understand this.

Here's the first two lines of your first script:

#include <IE.au3>
$oIE = _IEAttach ("<title string>","Title")
And that worked.

Now here's the first two lines of your second script:

#include <IE.au3>
$oIE = _IEAttach ("<title string>","Title")
And that failed already.

That doesn't make any sense. It's hard to talk about what to do next when things are already weird on the second line. You're not telling us something here...

:x


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

mmm dumb me :x

let me try this again before coming back to u :P

Share this post


Link to post
Share on other sites

Me back again

I have been trying to us IEattach without much success

So i have started to use IEcreate and close that window, once after copying the table contents using _IETableGetCollection and _IETableWriteToArray...

This is very sicko...and i really dont know the real way to Attach an IEwindow using various modes...

I have been trying to attach to window like this...any help is appreciated

http://img109.imageshack.us/i/tradelogscreen.png/

(sorry img enclosure is not allowed here !)

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