VB.net Open new IE window - vb.net

another one I cannot seem to find. But in vb.net, how do I force a new instance of IE or Chrome when clicking a button?
I may have already existing windows open, but I want to make it where when I click my button, it opens either Chrome, IE, etc. open new instance.
Is this even possible? Thanks!

The exe's should be in path so you can just run them like this
Process.Start("chrome.exe", "--new-window http://www.bing.com")
Process.Start("iexplore.exe", "http://www.bing.com")
If they aren't in path, you'll need to provide the full path to the exe, like c:\program files\internet explorer\iexplore.exe
By default on my system chrome opens up a new tab if you run chrome.exe without the --new-window parameter. When I run iexplore.exe, it always opens up a new window by default.

Related

autoit +selanium on jenkins does not work

enter image description hereI have a selenium test implement for web application and implemented autoit to do a folder upload to my application. This folder upload initiates a chrome popup warning which has no title but 2 buttons "Upload" and "Cancel" (default selected). The folder upload is in the control of my application and has title for the popup window. So I could see controlfocus worked on upload folder popup even when my test was deployed on jenkins. But it does not click on the Chrome popup warning
#include <WinAPIFiles.au3>
ControlFocus("Select Folder to Upload","","Edit1")
ControlSetText("Select Folder to Upload","","Edit1","<Myfolder Path>")
sleep(4000)
ControlClick("Select Folder to Upload","","Button1")
sleep(4000)
;this is for the popup warning from chrome
ControlFocus("[CLASS:Edit; INSTANCE:1]","","Edit1")
Send("{LEFT}") <===== this and below does not ever work on jenkins but works on local
execution
Send("{ENTER}")
;sleep(10000)
exit(0)
my selenium code has
String filepath = ".\\uploadfile.bat";
Process p1 = Runtime.getRuntime().exec( filepath );
uploadfile.bat is ....
START /wait c:\AutoIT\uploadfld.exe
As first step run yours AutoIt script, and just after that click the HTML element using selenium.
Do not try to run AutoIt script after clicking the HTML element in selenium, as this stops your selenium because browser waits for file selection.
And as I said in one other cases (question which I answer some time ago), there should be other possibilities to do that without AutoIt, even without invoking the pop up window.

Change default browser while using scrapy's shell view function

While on a scrapy shell, when I try to use the view(response) function, instead of opening a browser, it opens Visual Studio Code. How to make it open on a browser?
I read that webbrowser is the library used to view the page and that I could set the BROWSER variable to change its default. On a Linux Mint system, to which value should I change the BROWSER variable to in order to make the view command to open firefox?
Found the answer myself after some further searching.
The value of the BROWSER variable should be /usr/bin/firefox.
So, in my case, adding the following line to my ~/.bashrc file did the trick:
export BROWSER=/usr/bin/firefox.

CMD window Close automatically after Jenkins build is over

I trying to run Selenium grid and node using Jenkins but the CMD windows always closes after executing the steps
i am running the below code in Jenkins Window Batch Command
cd "C:\TapsiumACSS\Grid3.9"
start Hub.bat
I need the CMD window to be opened
You can create a shortcut of the bat file and under properties in the target section you have to add &PAUSE
This will pause the command prompt until an user input is done.
Just a opinion, Not a good idea to use Jenkins and ask the user to do something as that defeats the whole automation aspect... Instead copy the selenium results into a html or text file which can be viewed later :)
P.S. you will have to refer to this bat file location in Jenkins i.e. the shortcut location
Hope it helps :)

Static html pages run from file system instead of built-in web-server

I'm running Intellij 13 Ultimate. I'm trying to open a web page I'm working on, and it's opened from the file system:
file:///Users/<username>/dev/index.html
Instead of something like:
http://localhost:<port>/index.html
Thing is, other projects run as expected and I can't figure out what's misconfigured in this specific project.
How do you open the page?
If you open your HTML file inside IntelliJ and go to Run > Run xxx.html (or Debug), a localhost page should be opened. If it isn't, check your Run Configuration (Run > Edit Configurations) and check the URL field.
View > Open in Browser should also work as expected.

Using Firefox HTML source viewer in VB.NET?

I want to view the HTML source of a web page, I've using ICSharpCode.TextEditor, Scintilla,... and they're all good. But, I have missed Firefox HTML source viewer.
I wonder if I can use Mozilla ActiveX Control to open the source viewer or is there a command line argument that make Firefox open it? Thanks!
You can do that from the command line like:
$> firefox view-source:http://stackoverflow.com
Or you can put something like this in the URL bar: "view-source:http://stackoverflow.com"
If you happen to want to open it in a new window:
$> firefox -new-window view-source:http://stackoverflow.com
There is a reference at mozillazine.org.