Coded UI testing in multiple IE browser windows - visual-studio

I am testing a chat client at a web service. I thought the best way to do this was to open the website in one internet explorer window, log in, open the chat. Then open a new IE window(in private mode so that the log in details will be forgotten) go the the page and then log in with another user and open the chat, and then start chatting with the other user in the other browser window.
The problem is when I have done everything in the first window and I open a new window, all actions are triggered in the first window even though the second window is selected. Is there any way to select which browser window to use? Or are there better ways to test this functionality without opening two internet explorer windows?
Solved: I solved this by opening a new window in private mode. When I wanted to do actions in that window I defined the browser window as:
BrowserWindow privateWindow = new BrowserWindow();
privateWindow.SearchProperties.Contains("[InPrivate]");

You need to find some characteristic of the two IE windows that is different and ensure that it is included in the search criteria used to find the two windows. However modern browsers are complex, the distinction between windows and tabs it not always clear; window titles can change depending on which tab is selected.
Specific windows are selected by setting the properties of the UITestControl objects (and of derived objects). In the UI Map editor the properties panel has fields for the "Windows Title" and the "Search Criteria". For some controls there is also a "Filter Properties" field. The same fields are available if hand coding rather than recording tests.

Related

Open a popup (e.g. native browser) from a Teams desktop client app tab

Is there any way to pop open a browser window from a Teams app tab (desktop client)?
I came across the following link and from my interpretation of the reply it seems it's not possible.
Quoted from link for reference:
Unfortunately it’s not possible to use window.open in Teams tabs. Because we block opening of new windows to arbitrary sites within our Teams Desktop Client (for security reasons) you need to always use microsoftTeams.authentication.authenticate (if you want a popup window) or microsoftTeams.tasks.startTask (if you want an iframe-based dialog) to open a secondary app view.
It's not very clear to me what the microsoftTeams.authentication.authenticate reference above is suggesting.
Alternatively, if not a browser window, can we attempt to open another app installed on the device (e.g. Excel)?
Thanks in advance!
Are you just wanting to launch a new browser entirely? If so, a regular anchor tag, with a target attribute (e.g. ...), will work fine (I'm doing this in a tab myself, and it's working without problem).
You could try using a TaskModule to open a custom HTML/ Javascript or an iframe based widget inside a popup from within your Teams tab.
microsoftTeams.authentication.authenticate() will let you Authenticate the user against you tab. You can find the docs for this here.

Is there a way to make the displayed tab in Firefox "follow" the opened Inspector window(s)?

When I am debugging frontend work, I frequently have multiple Inspector windows open at the same time, each inspecting a different page. As I change Inspector windows, I would like the displayed tab or window to follow me. In other words, I would like the browser to always automatically change to the page I am inspecting; I do not want to change Inspector windows, then go to the browser and find the corresponding tab or window myself.
Is this possible in Firefox? Is it possible in any browser?
(I realize I could dock the Inspector to each tab or window. I do not want to do that because I use the multiple Inspector windows side-by-side for comparison.)
While I am not aware of any way to switch to the target browser tab when selecting a given inspector window, you can certainly do it the other way around:
Say you have 3 tabs opened, and you have opened devtools for each them, in window-mode (undocked). Now, whenever you select any of these 3 tabs, if you just hit F12 (or ctrl+shift+I/cmd+alt+I), then the corresponding devtools window will be brought to the front.
That's an easy way to keep track of which devtools window is linked to which browser tab.
Now, doing this the other way around would require a new feature to be implemented. This can't really be automatic (or at least hidden behind a config of some sorts) because it could be considered frustrating to some users, having their current tab being switched away from each time they click in a devtools window.
I have filed this bug to get it done: https://bugzilla.mozilla.org/show_bug.cgi?id=1163646

Open IE in kiosk mode BUT not maximized

Can we open IE in a kiosk mode - but not in a maximized view? We are trying to open an IE instance from a C#.NET app. This instance opens in a kiosk mode but disables the user to select 'OK' on the print preview pop up (as IE is maximized covering the whole screen). We want some way to open ONLY a specific page in IE (thus in kiosk mode) but not covering the full screen so that the user can choose the print options.
Alternatively is there a way to completely disable the print options and print silently using the default options?
Any ideas/suggestions?
It sounds like you're looking for the WebBrowser control, which allows you to embed IE inside your program.
I would take a look into Microsoft HTML Applications:
http://msdn.microsoft.com/en-us/library/ms536496%28VS.85%29.aspx
They are going to give a little more control over how the chrome of the application is displayed, and runs within the context of the currently logged in user.

Any way to programmatically force IE8 to open popups in a new window instead of a tab?

Is there a way to programmatically instruct IE8 to open a popup in a new window rather than a new tab? I know that IE supports modal windows but I have a bunch of legacy code with ordinary popups.
Update:
I am using Javascript's window.open() method to create popup windows. However, when a user has their IE8 settings set to "Always open popups in a new tab", the popup is launched in a new tab rather than a new window.
Using html, the best you can do is set open page target to blank. Everything else is controlled by the client side and they can choose to open it in a new window or tab.
However, you can use javascript to open the window. Create Link to open in new window here
Since no one else is chiming in... After doing further research, it seems that you cannot force a pop-up to open into a new window when an IE8 user has the following browser setting enabled: Tools>>Internet Options>>Tabs>>When a pop-up is encountered:>>Always open pop-ups in a new tab.
Since I am in an Intranet environment, I have the option of locking down a users IE settings to either "Let Internet Explorer decide how pop-ups should open" or "Always open pop-ups in a new window".
I don't really care to exercise the above option so in order to get the desired user experience, I will resort to making one of the following code changes:
Convert existing pop-ups to IE specific Modal Dialogs using the showModalDialog() method.
Convert existing pop-ups to Javascript Modal Dialogs using jqModal or some other jQuery plug-in.
If you opt to let Internet Explorer decide how to display pop-ups, it
will display the pop-up in a new window if the pop-up specifies size
or display requirements. Otherwise, the pop-up is displayed in a new
tab.
http://windows.microsoft.com/en-US/windows-vista/Tabbed-browsing-in-Internet-Explorer-8-frequently-asked-questions
So if you don't set any specific window requirements and it should open in a new tab, unless a user has changed these settings.

Internet Explorer 8 - Session Shared among Explorer Window

IE 8 sharing session among different Explorer Window for same domain.
Like if you are a logined at hotmail.com in IE 8, and you have open another explorer window for hotmail.com, you will automatically logined.
This was not in IE 7, In IE 7 session has shared in the same explorer tab rather different Explorer Window.
Can anyone have a idea about this, Whether it is bug or something else in IE 8
Use
File -> New Session
Well, it is not a bug. Browsers usually share data via cookies. IE8 have this 'new session' feature to let you use multiple email accounts (and similar services) with multiple browsers.
Modify IE8 Shortcut to Permanently Launch New IE Browser Window in New Session
Right click on the IE8 shortcut (all IE8 shortcuts or icons on desktop, Start Menu, Quick Launch bar or Taskbar that you want it to run as a new instance session have to be changed), and choose Properties from the right click context menu. Then, append -nomerge to the end of the of the program path in “Target” text box at “Shortcut” tab. For example,
“C:\Program Files\Internet Explorer\iexplore.exe” -nomerge
link
http://www.mydigitallife.info/2009/07/22/run-separate-isolated-ie8-window-frame-session-with-nomerge-switch-for-multiple-logins/
Create a new shortcut to ieplore.exe, add the -nomerge switch. This will always start a new session.
I prefer using "Run" and just type "iexplore.exe -nomerge"
Your question isn't that clear.
Are saying in IE8 when you open a new window that window shares the same session as the previous window hence any login made in one is shared by the other?
If so then that would be normal behaviour and not any different to the way IE7 handled it.
OTH are you saying that when you open a new window in IE8 it doesn't continue to share the same session as the previous window? If you mean using the New Window action from the Page menu then that would appear to be a bug to me but it doesn't happen on my copy of IE8.
If by new window you mean starting a new instance of IE from quick links or Start menu then it would be correct for that to start a new session and not share session cookies with the other session you have running.
I suspect this last is the real situation, previously the standard IE link added to Start Menu or Desktop would simply open a new window using one of any existing IE sessions currently running, IE8 doesn't do that it will invoke a new session from this link.
You can prevent new windows from sharing session cookies by File -> New Session, however you cannot prevent new tabs from sharing data by default.
Any new window that you open (using iexplore.exe and not openning from inside another window) shares the same session as any previous.
Open a window and log in into your bank account.
Open another window (blank window).
Close the bank account window by clicking on the X.
Wait 5 minutes (just to emphasize the problem).
open another window and type the bank account address.
Result => You are logged into the bank account.
Don't tell me that this is not a bug. This is a huge one! (maybe a design bug)
Most users do not expect this behavior and complain that there is a "problem with our site" because they have another window open on some radiostation which makes sure the session of another site is persisted, I then have to explain to them that Microsoft/Google decided that that's the "right" way. The default should be -nomerge and not the other way around.

Resources