Micro Focus QTP (UFT) Forums

Full Version: Text being added to wrong IE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to update a text field , but it fails on line 4 below. It seems to be looking at the wrong IE window.

Line 2 is selecting a text box to add information to from QTP executed copy of IE. I popup box appears. Line 3 takes about 20 seconds, then updates a text box in the QTP executed copy of IE rather than the IE popup text box. Line 4 fails as it is also not at the popup and therefore can't select the submit button.

How do I get QTP to select the correct IE to put the text message in.

Code:
'Add User, Date and Time in Description Field
Browser("Certificate Error: Navigation").Page("Page_13").Image("update_01-sel").FireEvent "onmouseover"
Browser("Certificate Error: Navigation").Page("Page_13").Image("update_01-sel").Click
Browser("Browser").Page("Page_9").WebEdit("desc").Set sDescriptionText
Browser("Browser").Page("Page_9").WebButton("Submit").Click

Hi Michael,

As per my understanding, U want to enter the value in the text field which is there in the pop up window.
Its better to check for the pop up fires.. U can use code something like this...
'First check the popup..
If <Ur popup Window>.Exist Then
'Now set the value to the text box in the pop up
'Finally click submit button

End IF

Do correct me if i have misunderstood ur query.

Regards,
Ankesh
I tried using exist, but it still is not working. It seems the active IE is not the pop up, but the original IE. Text is still populating in some field in the other IE and not the popup. When the if statement is taking about 20 secs then it goes onto the next, waits another 20 seconds, then sets the description in the wrong IE window. Any other suggestions?[/quote]

Code:
'Add User, Date and Time in Description Field
Browser("Certificate Error: Navigation").Page("Page_13").Image("update_01-sel").FireEvent "onmouseover"
Browser("Certificate Error: Navigation").Page("Page_13").Image("update_01-sel").Click
If Browser("Browser").Page("Page_9").WebEdit("desc_2").exist then
    Browser("Browser").Page("Page_9").WebEdit("desc_2").Set sDescriptionText
End if
When the script fails not recognizing the pop up, I stopped qtp and move the code to the front of the script to test with the open main page and the pop up. The script runs fine and recognizes the pop up and correctly sets the text box and cliks submit. I just does not work within the subroutine.