Starting Multiple Visual Studio 2012 Web Applications in Tabs of a Single Browser Instance - asp.net-mvc-4

I have two ASP.NET MVC 4 projects in a single solution in Visual Studio 2012. I have the solution set to use multiple startup projects, with the action set to Start. When I click the Start toolbar button, each project starts in a different Internet Explorer browser window.
But I'd like the two projects to start in two tabs of a single browser instance. Is there a way to do that?
Thanks!

The only way I know of to do this is:
Add a simple view in one of your projects with essentially empty html. Set that project to launch the simple view as its startup page, and set the other projects to "Don't open a page, wait for a request".
In the head section of that empty view, add the following javascript script section:
<script>
// to open another project in a newtab (works in IE)
window.open('http://localhost:<otherprojectport>/otherprojectpage', 'tab1');
// As many of these as you like as well, to open other actions/pages from this project:
window.open('#Url.Action("Edit", "User", new { id=1 })', 'tab2'); // note different name
// and to open a third page in the original tab that opens:
document.location.href = '#Url.Action("Index", "User")';
</script>
It is the only way I have found to do it, so far, and anyway I find it easier to edit a single view than multiple project property pages to change the tabs that open.
You may have to tell your browser that it's ok for your site to open popups. To do that, just exclude the document.location line the first time you run it, and it will tell you it blocked a popup so you can then "always allow them" for your site.
Footnote
If you then want to use the chrome launcher as well the only solution I found was to do the above but use an extension (such as "One Window", which I am not endorsing, nor claiming is secure, don't blame me if your computer leaves home if you use it) to stop the pages loading as separate popups.

Related

How to generate Domino dialogboxes on traditional (non-xpages) webforms

I want to have a popup/dialogbox with an "OK" button on it that will close the dialogbox...after someone performs a task on a Domino webform. I know I used overlays in xpages before, but the current application I am maintaining was built with traditional Domino forms (lots of pass-thru HTML) and my initial attempt to build an overlay effect did not work.
I have tried using javascript code of:
var window = window.open(url, windowName, [windowFeatures]);
...but this has not been successful. No errors in debug, yet my url page does not pop up. I am hoping someone might be able to provide a snippet of what you use so I can see where I am going wrong.
The url parameter I am passing is correct, as I used an alert to show me what was going in there, but I am doing something basic wrong.
If I can answer any questions for you I can do that as well.
Thank you
The only way I know to display a dialog box in a classic Domino web application is to do just like you would on any HTML-based webpage. Either you create your own popup functionality, or you use one of the many plugins available.
When I work with classic Domino web applications, I have often added Bootstrap to it, to make things look a bit better. Then I can use either the native Bootstrap dialog boxes, or a plug-in called Bootbox.js. But there are many other ones.

How do I open new tabs in the Run and Documentation tool windows of IntelliJ?

I want to open multiple Documentation tabs and also multiple Run tabs at the same time, but I couldn't figure out how. Every time I press Ctrl+Q to view documentation, or run a configuration, it always replaces the current tab (screenshot below, here I put Documentation and Run tool windows side-by-side). Is there a way to do this?
EDIT: I have managed to open another Run tab if I run a different configuration. But can I run the same configuration and have it open in a new tab? (Also the problem about Documentaion tabs remains unsolved.)

How to handle external applications in a selenium-test?

I am writing a test that verifies that a warning to the user before the user opens a document. If the user says that they still would like to open the document, the document opens in an external application (pdf or word).
But now I have an external application over the browser window, and it messes up for other tests.
So, what are the best practices around this kind of issue? Rewrite of the appliction to allow for not opening documents in test?
Added description:
The problem is twofold.
1) It starts processes (word and acrobat) that fills the desctop and requires resources from the test-slave
2) The external process seems to interfer with other tests since (guessing here) it is located over the browser window.
what i understood from your post is, the document(word/pdf) is opening in the browser window hence you are not able to proceed with further steps. If so, you can verify the Title to make sure the document is opened in browser window and can navigate back using below snippet.
driver.navigate().back();
Hope this helps.
What I understand from the line
'But now I have an external application over the browser window, and it messes up for other tests.'
is that once user clicks on open button a new window opens up (Window based application) since you have mentioned PDF or Word.
You can use robot class in such cases, below code snippet will close the current active window:
Robot rbt = new Robot();
rbt.keyPress(KeyEvent.VK_ALT);
rbt.keyPress(KeyEvent.VK_F4);
rbt.keyRelease(KeyEvent.VK_ALT);
rbt.keyRelease(KeyEvent.VK_F4);
Make sure you deal with sync issues properly so that intended window is closed instead of AUT.

How can I navigate to different webpages in the same MSIE window in VB.NET

I have code that opens a new window but I want to be able to edit the same one.
System.Diagnostics.Process.Start("iexplore.exe", "http://www.live.com")
I'm not sure exactly but a good pointer to start off might be to get the handle of the window you're interested in:
http://www.pocketpcdn.com/articles/dotnetcf_hwnd.html
And then separately investigate what interop messages you can send to IE to change the URL in tab X
In order of increasing difficulty and increased control/power:
Send input text to your IE process. Alt-D to focus on the navigation bar, then the URL, then ENTER.
Use MSAA to find the navigation bar and send it text, as above.
Use MSAA to get IHTMLDocument access to the browser, and then programmatically drive the browser with that, and the related interfaces.
I don't know your exact scenario, but if you can host your own instance of MSHTML, or a WebBrowser control, it will make it a lot easier to get the interfaces and do the manipulations mentioned in #3 above; doing that stuff cross-process is fraught with peril.
I just did a web search and turned up a WatiN tool that apparently wraps a lot of this work; perhaps it would be useful for you.
If you are using 2008 there is a feature where you could create a second form and then add a Webbrowser control
the page could then be called by
myForm.show
The page could then be changed with the
Webbrowser1.Url = New Uri("http://www.google.com")
Use the following code:
System.Diagnostics.Process.Start("http://www.live.com")
That is: do not invoke iexplore.exe directly – just let the system figure out which default browser to open.
This may yield two behaviours:
Either it opens a new tab in an existing Internet Explorer window,
or it creates a new window.
The important point is that this depends on a preference that can be controlled within the Internet Explorer application. If a new window opens, then this is the setting chosen by the user – do not try to override it: overriding the user’s preferences is considered bad manners.
If the users don’t want a new window opened, they can simply change that in their Internet Explorer preferences.

open IE without toolbar or address bar from Windows VB Application

Shell ("explorer.exe www.google.com")
is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address bar links etc. Doing this via an inbrowser link is easy enough
<a href="http://page.com"
onClick="javascript:window.open('http://page.com','windows','width=650,height=350,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'); return false")">Link text</a>
But how would I go about adding this functionality in VB?
If you want it to look professional, you need to use an actual browser component. VB.NET comes with one. If you are using an older version of VB, you'd need to go third party. If you want to stay with a shell open, you would have to individually target the browser command-line and pass arguments to indicate that it should not have toolbars etc.
Speaking as a user, I find castrated popup windows annoying and unproductive.
So my answer is: "don't".