Hanlding multiple browser windows using Testcomplete - testcomplete

Can any one help in below scenario using testcomplete.
I need to handle two browser windows and verify some text on two browser windows.
Please let me know how to take two browser windows and pages instances to an array using JScript.
Thanks,
Naveen.

If the URLs of the pages are different, you can assign the page objects to separate variables and work with them further.
var page1 = Sys.Browser("chrome").Page("http://www.google.com");
var page2 = Sys.Browser("chrome").Page("http://www.smartbear.com");

Related

Identifying corresponding IE Tab using VBScript

I am trying to write a VBScript for getting hold of a IE Tab which is already opened(After which i will get the Form ID and use it to post AJAX Post request with some data and update the server).
I know a possible method which would work for me , (i.e.) using the Title of every IE Tab i can match with my site name which i would like to get hold of and then get the corresponding IE Instance, but this is a performance issue for me.
So this is what i am planning to do , i can possibly create a local file from my Website with the process ID of my IE tab and any other detail required by the VBScript to grab this Tab among all other opened IE Tabs.
In My VBScript i would run through this file which was updated from my Web-page(Using a Applet since it should create the file in client side) , identify the parameters of the IE tab in which my Web-Page is displayed and then use those details to Get hold of the Corresponding IE Instance.
Please Help me in identifying which parameters i would need to update in my File (like process ID , etc..) so that VBScript would be able to recognize my web-page even without searching through all the open IE Instances.
Any sample example of the VBScript would be very much appreciated..
Thanks a bunch in Advance :)
Tabs of running Internet Explorer instances can be enumerated like this:
For Each ie In CreateObject("Shell.Application").Windows
If ie.document.location = "..." Then
'do stuff
Exit For
End If
Next
Why do you think performance would be an issue with this approach?

Html5 web pages in a window

I'm trying to get a web page in a window within a web page, so basily what I want is something like a standed os,
you have a exe it opens with in a window, well I want that but in HTML5
Would I use Ajax?
Anything would be helpful at this stage!
Thanks jrop
For your problem you don't need HTML5. You can solve it by using jQuery.
jQuert window plugin (You can choose one of them depending on your need):
http://fstoke.me/jquery/window/
http://hernan.amiune.com/labs/jQuery-Windows-Engine-Plugin/jQuery-Windows-Engine-Plugin.html
http://swip.codylindley.com/DOMWindowDemo.html
http://pierrebertet.net/projects/jquery_superbox/
If you want an actual window then you would use open. If you want a pseudo-window inside a page, then you would use <iframe>. If you don't want an actual page, but just a chunk of HTML then you would use DOM manipulation to create the elements in the page (and possibly Ajax techniques to get the data over HTTP if you don't have it in the page already).

Global detect browser and show different view in ASP.NET MVC 3

I have an ASP.NET MVC 3 application that I want to detect what browser the user is using globally so for example if they visit: app.com/login or app.com/organisations etc the check will still happen.
What file would I be best putting such code in? The code should check if their browser is a certain version and if so then load a different view and layout.
so e.g.
if(browser is ie < 9)
return ('chromeFrame');
elseif (browser is ff < 4 etc)
return ('upgradeBrowser');
Can anyone point me in the right direction?
To clarify this wouldn't be a redirect rather calling different views and layout if the browser isn't correct so the url wouldn't change and it would happen on any url!
One way to do this would be using HttpBrowserCapabilities that is exposed on the Request as Request.Browser.
Be mindful however that the .browser file that is used to identify browser capabilities may not be updated as frequently as new browser versions are released.

How do I share data across multiple browser tab or windows?

I m currently building a facebook style notification system for my site.
I m using long polling. So, the server sends data if its available and closes the connection.
Now the problem i m facing is that, i want it to share across all open tabs or windows of that browser.
I m using a cookie to detect if a tab is already executing the ajax call, so other tabs will not execute it until the operation of the first tab is complete.
Now what i want is, to have an effective way, so that i can show the data across all open tabs in the form or a small fb style popup box.
The goal is if the last active ajax call has some data, then a small popup box will show up on all open browser tab or windows.
As, a theory i may be able to do it via cookie, but i want to know if there is some better way to do that.
Thanks,
Anjan
Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie.
If you're ok with the cookie idea, follow these examples:
For client side access
For PHP access
For NodeJS

Is it possible to maintain different sessions (users) in different window tabs using Spring 2.5?

We have a requirement where support for different users in different tabs of a browser window. How can we achieve this in Spring 2.5? The application is based on Users, where users will have their own agents and articles. An internal user should be able to login to different user accounts in different tabs at same time and manipulate their data. Any help is much appreciated.
A browser's cookie store does not distinguish between different windows or tabs when deciding what cookies to send. So a cookie based approach won't help.
My suggestion for an alternative would be to have a hidden "userName" parameter that is passed back and forth as a URL query parameter for all requests from a given tab or window. You could finesse the setting of the parameter in browser requests by using some Javascript to add a hidden parameter to each of the HTML forms in the page just loaded. The parameter value would be snarffed from the query string of the current page URL. You'd just need to make sure that all pages included stuff in the header to load the JS and run it when the page load completed.
Generally speaking, no, because all of the tabs within the browser window share the same cookies.
One way to do it would be use multiple domain names all pointing at the same app. Each domain name would have its own set of cookies. You would need to have some way of switching to a new domain name after you open a new tab.
How about, have a set of bookmark toolbar bookmarks, each corresponding to a different domain name. Control-click on the bookmark and it opens in a new tab. You could provide the users links in your navigation to the different domains that they can drag onto their toolbar.
Depending on what browsers your users are using you could get even slicker - in some browsers Javascript window.open() opens a new tab. You could have the JS compute the new domain name before the window.open().

Resources