Opening second browser window
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Opening second browser window
Hi All,
I'm currently working on a problem that bothers me a bit..
I run cross browser tests for a web application.
Now, while having opened one of the browsers with the application under test (IE, Chrome and FF) i need also to open a second browser screen (that needs to stay open during the testing of the cross browser testing). The additional browser is IE (as the application from which i need to compare with only runs in IE (silverlight)). How can I open the additional IE browser with the second appilication while doing cross browser testing on the three other browsers.
Any help would be appreciated! The only thing i discovered on the forum is about new tabs, not new windows.
As i need to reuse the additional IE (to look for info) I need to keep that window opened until tests are finished.
Best regards,
Dominic
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming the second instance of IE is open at a different URL, use the URL to tell them apart.
I do this all the time. Have up to 5 instances of the same browser open. All with different URL. Works fine.
(One thing I do that makes this a little easier is open any new instance of the browser with a small stored HTML page. Just a simple little page that says something like "This is your new browser". Then I can easily tell which one is the newly opened one as it will be open at this page. Grab the new one and navigate off to wherever it needs to be. Then when you open another one, it starts on the stored page. Identify. Navigate away .... etc etc.)
If you have multiple browsers, all open at the same URL, then telling them apart can be a problem.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Colin,
Thanks for helping me out.
I can't seem to get two browsers open.
This is the sequence of things i wanted to follow:
I open IE (with the silverlight application)
then I want to run the tests on all browsers (IE, Chrome, FF) with the application under test.
each browser is started and closed after the test.
Last thing would be to close the IE with the silverlight application)
Problem is that when firing up the IE with the AUT, He recognises IE as being open already, and uses that window instead.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not clear?
Are the AUT and the Silverlight page on different URL's?
If they are, you should be OK.
How are you starting IE? I start it using a Windows Shell object to start the EXE with command switches. This forces IE (or whatever other browser you're using) to start on a specific page. I then find that page (and other browsers already open will NOT be on that page - it's my own little HTML start page remember) and all is well from there. Once it finds the right page, you know it's using the right browser.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Colin,
URL's are indeed different.
I think the problem starts when opening the browsers.
You are using the windows shell object, while i'm using the 'browsers.item' and hoping we could continue using this....
I'll have to rethink the way i'm opening browsers.
Thanks for your input.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suspect you might.
As I say, I use a specific start page (stored on the local machine and ref'd as a start parameter when I launch the browser) so I can tell them apart. Beyond that, you'd have to resort to index numbers or something horrible and unreliable along those lines.
Had to do it this way for exactly the reasons you're having problems.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Colin,
It probably explains why i'm having the same trouble you had....
Thanks for your help!
Much appreciated!.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Colin,
If it would be possible: could you provide me with some code on how you handle this issue?
(I'm using vbscipt, but any code will do, i'm able to translate)
It kept me awake part of the night to get this solved....
Thanks in advance!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No problem. The project this is from is VBScript handily enough.
Declare the shell object:
Set OWS = CreateObject("Wscript.Shell")
And then (one for IE, one for Chrome .... I don't use FireFox) use it to start the browser:
OWS.Run("iexplore.exe \\Path\To\Stored\Web Page\page.html", 1)
OWS.Run("chrome.exe --disable-hang-monitor --new-window file:///" & "//path/to/stored/web%20page/page.html")
(Note: IE handles spaces in the command line switches OK. Chrome needs "%20" replacements for spaces.)
Then I put it in a loop to make sure it opened OK:
retries = 0
Do
temp = Sys.Browser("<iexplore/chrome/whatever>").WaitPage("*/page.html", 5000).Exists
retries = retries + 1
Loop until (temp) or (retries = 3)
And then if it finds it OK, I assign the new browser/page to an object and pass it back:
Set NewBrowser = Sys.Browser("<iexplore/chrome/whatever>").Page("*/page.html")
From that point on, you just search for things at page level and assign the page to an object while you work with it. Or have multiple ones open and have the page objects exposed globally. Whatever works best for you really.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fantastic Colin!
Thank you very much.
