Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
test if a web page is visible on the screen
#1
Not Solved
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):
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
This is very strange for me,
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
and this works fine.
But still can't catch why cannot use repository objects to test this stuff.
Reply
#2
Not Solved
Hi ,

I think this might be bcoz of the 'creation time' of the Browser. Remove the 'smart identification and ordinal identification 'in the repository and use only the fields which you used in the 'descriptive programming' to identify the same. This might do...

Thanks,
Harish
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  active screen in uft one koslender 0 1,198 12-01-2020, 05:45 PM
Last Post: koslender
  Exist and Visible Are True When Objects Aren't There - Is there A Better Way? zunebuggy 3 2,729 04-24-2018, 02:12 PM
Last Post: Ankur
  click each web link in a page using Index or other method in QTP smeijer 13 23,674 04-29-2017, 04:53 PM
Last Post: kowshik
  Find a value in SAPGUILabel Screen jimgral 0 2,979 07-14-2016, 01:46 PM
Last Post: jimgral
  [UFT] [WPF] DataGrid: check if vertical and horizontal scrollbars are visible robertosalemi 0 2,255 07-13-2016, 06:33 PM
Last Post: robertosalemi

Forum Jump:


Users browsing this thread: 1 Guest(s)