Micro Focus QTP (UFT) Forums
Actions in a new Browserwindow - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Actions in a new Browserwindow (/Thread-Actions-in-a-new-Browserwindow)

Pages: 1 2


Actions in a new Browserwindow - QADBA - 07-24-2008

Hi,

i have problems with a new browserwindow which is opened during the test run.

If i only test the part with this window, everything works. No problem.
If i run the whole script, it sometimes happens that the script opens the new window, but then the script want to do the actions to the first window?!?

Example:
Code:
Browser("xyz").Page("xyz").WebEdit("signup").Set "iamatest"
Browser("xyz").Page("xyz").Link("tonewwindow").Click
Browser("new").Page("xyz2").Image("abc").Click
Browser("new").Page("xyz2").Image("abc2").Click
Browser("new").Page("xyz2").close

I tried to test with Browser("Title:=" & Titletext), but this only works with
Browser("Title:=" & Titletext).Close

Can someone help me?


RE: Actions in a new Browserwindow - gammaflare - 07-25-2008

Multiple browser instances can be tested using the creationtime property of the browser. What you need to do here is......go the descriptive programming way or add another property to the new browser in the object repository......

the code should look something like this.....
Code:
Browser("name:=new","creationtime=1").Page("name:=xyz2").Image("name:=abc").Click
Browser("name:=new","creationtime=1").Page("name:=xyz2").Image("name:=abc2").Click
Browser("name:=new","creationtime=1").Page("name:=xyz2").close
this I hope should solve your problem......


RE: Actions in a new Browserwindow - QADBA - 07-25-2008

But If i record the following:

Code:
Browser("Google").Page("Google").Image("Google").Click

And i change it to:

Code:
Browser("Creationtime:=1").Page("Google").Image("Google").Click

I get following error:
The "Google" object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.

Even if i add a new property named creationtime with value = 1

I didn't have to work with the OR until now... (mostly just recording)
How do I have to proceed in this example?


RE: Actions in a new Browserwindow - FredMan - 07-26-2008

If you start with DP, you have to stick with it on that line of code. So

Code:
Browser("Creationtime:=1").Page("Google").Image("Google").Click

should be

Code:
Browser("name:=Google","creationtime=1").Page("name:=Google").Image("name:=Google").Click

just like gammaflare suggested.


RE: Actions in a new Browserwindow - gammaflare - 07-26-2008

And also please bear in mind.......

creationtime=0 for the first browser
creationtime=1 for the second browser
creationtime=2 for the third and so on.........


RE: Actions in a new Browserwindow - QADBA - 07-28-2008

If i use

Code:
Browser("name:=Google","creationtime=1").Page("Google").Image("Google").Click

following Run Error occurs:

Wrong amount of arguments or invalid property allocation: 'Browser'

If i try only

Code:
Browser("name:=Google").Page("Google").Image("Google").Click

then i get this:
The "Google" object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.

What am I doing wrong?


RE: Actions in a new Browserwindow - FredMan - 07-28-2008

Try
Code:
Browser("CreationTime:=0").Page("micClass:=Page").Image("Google").Click



RE: Actions in a new Browserwindow - QADBA - 07-28-2008

Same problem, if i use following:

Code:
Browser("CreationTime:=0").Page("micClass:=Page").Image("Google").Click
i'll get the message:
The "Google" object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.

As I understand, the tool is still not able to recognize the image "Google" via the creationtime of the browser.
But i don't know, how to handle this problem.


RE: Actions in a new Browserwindow - FredMan - 07-28-2008

Are there two browsers? If so change CreationTime to 1. Also try adding the image to the repository.


RE: Actions in a new Browserwindow - QADBA - 07-28-2008

No, at the moment there is only one browser window.
If i understand how it works, i'll test with a new opened browser window.
Up to then I can use Browser("CreationTime:=0").

The image is already in the repository.

After recording the repository looks like:

Test Objects
-Google (Browser)
--Google (Page)
---Google (Image)

And if i use the ("creationtime:=0") instead of ("Google"), the tool doesn't allocate the image to Browser("creationtime:=0"), although it should be the same. Or isn't it the same?