• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 982
  • Last Modified:

Alternative to window.opener

I want to  create an application testing tool (window 1) which will invoke methods in window 2 with various test values, but I don't want to have non application specific code in the window containing the application to be tested (window 2).  I'm using IE5.

What I have seen in the past is one window creating another and the created window using window.opener to refer back to the first window.  However, I don't want the tested window to contain any references to the testing window, but don't mind if the testing window has to be told "by hand" about the window to be tested.  
0
tweega
Asked:
tweega
  • 5
  • 3
1 Solution
 
tweegaAuthor Commented:
Edited text of question.
0
 
tweegaAuthor Commented:
Edited text of question.
0
 
PBallCommented:
I don't know of any other way to get a reference of another window without the parent - child relationship (opener property of the child).

If stress testing your web application is your goal, you might want to take a look at MS Web Application Test (formerly Homer) instead.  Downloadable free from Microsoft site.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
gpeeraerCommented:
If i understand correctly:

window1 creates window2 and thus window2 knows about window1 via window.opener

If you want to make this impossible set the opener property to the null value. After that the second window cannot reference the first.

thus in windows1 do

mynewwindow = windows.open(...)
mynewwindow.opener = null

hope this helps
0
 
tweegaAuthor Commented:
Many thanks for both comments.  I have been onto the Microsoft Site and downloaded 'Homer' - though I have not yet had a chance to run it or read its documentation yet.  Still, it sounds an interesting package.  Thanks again.

As for setting .opener to null - it wasn't quite what I was trying to do, although I appreciate your help all the same.    If you imagine that Window 1 has an input box into which one can type any characters, and that there is a method on the page that can validate the value, and another that can post it to the server.  I want to test that the system works by firing various random character strings at the box over the course of 24 hours (each time calling the relevant validate and post methods, and then waiting for a state variable to indicate the completion) to see how the system copes.  But I don't want to add code to Window 1 (i.e. code to test itself) that won't be in the release code.  I was sort of hoping with a rather wild and unthought-through optimism that one window might be able to communicate with another without some sort of parental link existing between the two.  Quite what I had in mind I'm not sure.  Anyway, I thought it was worth a fish.

It's my last day at the keyboard till the new year, so I'll hold out for any more comments till this pm and then close the question then.
0
 
gpeeraerCommented:
if you can distuinguish the completion of window1 by looking at the URL/address then you could write a script with an infinite loop which regurlarly sleeps and checks the URL/address of the other window.

window1 does not have to know about window2 and window2 can access all of the information in window1, when he needs to.

hope this helps

0
 
tweegaAuthor Commented:
Sounds spot on, but how does window2 get hold of the window1 object?
0
 
gpeeraerCommented:
in window2 do

window1 = window.open("applicationtotest.asp",...)
....
//  access from within window2 by referencing window1
window1.forms[0].inputname.value = "whatever you want"
window1.forms[0].submit(); // to submit the form in the other


Aroun this you can create an infinite loop which checks the window1.location once and a while as to see if you give input or not



0
 
tweegaAuthor Commented:
of course.  I was just in the process of starting to write to write to you again to say I had twigged what you meant.  I had hoped the solution would at least involve a polynomial equation, but the blindingly obvious will do even better.  Many thanks.

Merry Christmas. tweega.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now