Hello All,
I'am facing a strange behavior of QTP, could someone please eplain me what's going on ?
I want to check if a web page was opened in a popup window, and I don't know how.
Here is a test script - this clicks on a link that opens a new window with another page,
then clicking on this new page on another link closes this page (popup):
If I uncomment commented lines with 'TEST 1' and 'TEST 2' and run this script,
then results is:
TEST 1 - Exist ----> fine, web page is opened
TEST 2 - Exist ----> popup window is not visible, so my understanding is that the result should be 'Not Exists'
But if I uncomment lines marked as 'Test 0', the result is:
Test 0 - Exists ----> ???? window is not open yet ?
Test 1 - Exoists
then script breaks with 'run error - cannot identify the object 'back to popup window' on this line:
This is very strange for me,
please help me.
--- Edit ----
Now I use descriptive programming:
and this works fine.
But still can't catch why cannot use repository objects to test this stuff.
I'am facing a strange behavior of QTP, could someone please eplain me what's going on ?
I want to check if a web page was opened in a popup window, and I don't know how.
Here is a test script - this clicks on a link that opens a new window with another page,
then clicking on this new page on another link closes this page (popup):
Code:
Browser("micclass:=browser").Navigate("http://www.htmlcodetutorial.com/linking/linking_famsupp_70.html")
' ******* Test 0 ********
'If Browser("Popup Window - HTML Code").Page("Popup Window - HTML Code").Exist Then
' MsgBox( "Test 0 - Exists" )
'else
' MsgBox( "Test 0 - Doesn't exist" )
'End If
Browser("HTML Popup Windows - HTML").Page("HTML Popup Windows - HTML").Link("this link").Click
' ******* Test 1 ********
'If Browser("Popup Window - HTML Code").Page("Popup Window - HTML Code").Exist Then
' MsgBox( "Test 1 - Exists" )
'else
' MsgBox( "Test 1 - Doesn't exist" )
'End If
Browser("Popup Window - HTML Code").Page("Popup Window - HTML Code").Link("back to Popup Windows").Click
' ******* Test 2 ********
'If Browser("Popup Window - HTML Code").Page("Popup Window - HTML Code").Exist Then
' MsgBox( "Test 2 - Still exists" )
'else
' MsgBox( "Test 2 - Doesn't exist" )
'End If
If I uncomment commented lines with 'TEST 1' and 'TEST 2' and run this script,
then results is:
TEST 1 - Exist ----> fine, web page is opened
TEST 2 - Exist ----> popup window is not visible, so my understanding is that the result should be 'Not Exists'
But if I uncomment lines marked as 'Test 0', the result is:
Test 0 - Exists ----> ???? window is not open yet ?
Test 1 - Exoists
then script breaks with 'run error - cannot identify the object 'back to popup window' on this line:
Code:
Browser("Popup Window - HTML Code").Page("Popup Window - HTML Code").Link("back to Popup Windows").Click
please help me.
--- Edit ----
Now I use descriptive programming:
Code:
If Browser("name:=Popup Window - HTML Code Tutorial").Page("name:=examplea","title:=Popup Window - HTML Code Tutorial").Exist Then
MsgBox( "Test 1 - Exists" )
else
MsgBox( "Test 1 - Doesn't exist" )
End If
But still can't catch why cannot use repository objects to test this stuff.