Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am writing the test script in java using selenium webDriver.

I have a situation where while executing the test script different authentication windows will appear and might need different credentials.

For example when I open a url, a 'Authentication Required' window appears. Say this wants "uid1" and "pass1" as credentials. And when another link on that page is clicked anther 'Authentication Required' window appears and this needs "uid2" and "pass2" as credentials. In both authentication windows the title is same but the text is different.

How to handle this using AutoIT? Can anyone please post a sample code or guide me through this?

share|improve this question
add comment

1 Answer 1

If the order in which you spawn the windows is known, can you capture the handle value from the first window and then assume that the second window is the one that doesn't match that handle.

I am rusty on AutoIt so I didn't put any code, but I did use the oh so cool window info tool to get the values I would try to use. It's a life saver in situations like this.

First window:

>>>> Window <<<<
Title:  Authentication Required
Class:  MozillaDialogClass
Position:   2376, 597
Size:   453, 167
Style:  0x16C80084
ExStyle:    0x00000101
Handle: 0x000000000004097E #this appears unique, but not predictable

Second window:

>>>> Window <<<<
Title:  Authentication Required
Class:  MozillaDialogClass
Position:   2376, 597
Size:   453, 167
Style:  0x16C80084
ExStyle:    0x00000101
Handle: 0x000000000005097E #this appears unique, but not predictable

Essentially first window == 0x000000000004097E , second window <> 0x000000000004097E

Alternately, you can do each operation in a different browser and use the Title and/or Class to distinguish them.

First Window in FireFox:

>>> Window <<<<
Title:  Authentication Required
Class:  MozillaDialogClass 
Position:   2387, 597
Size:   432, 167
Style:  0x16C80084
ExStyle:    0x00000101
Handle: 0x000000000004097E

Second Window in Internet Explorer:

>>>> Window <<<<
Title:  Windows Security
Class:  #32770
Position:   2234, 634
Size:   439, 253
Style:  0x96C80A84
ExStyle:    0x00010101
Handle: 0x00000000000507EA 
share|improve this answer
    
Hi Lucas Schwarz, The windows might appear at different times. Both the authentication windows might not appear at the same time. We could not predict it. –  drtvskuthsav Nov 23 '13 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.