Reputation:
This is my code for opening Chrome browser on a variable page using vbscript:
Set browobj = CreateObject("Wscript.Shell")
siteA = "http://...../"
browobj.Run "chrome -url " & siteA
WScript.Sleep OneSecond*60
siteB = "http://..../Gest.do?operation=export&eser=123&ver=456"
browobj.Run "chrome -url " & siteB
Set browobj = Nothing
The first step opens the web page ( siteA ) for user authentication:
siteA = "http://...../"
browobj.Run "chrome -url " & siteA
The second step opens a link ( siteB ) where you pass variables for downloading an excel file :
WScript.Sleep OneSecond*60
siteB = "http://..../Gest.do?operation=export&eser=123&ver=456"
browobj.Run "chrome -url " & siteB
The second link ( siteB ) with the variables is opened in a new Chrome tab and the download is stopped.
Instead if the second link ( siteB ) opens in the same tab of the siteA the download is started. Tried manually.
I need reuse the same tab on is opening the siteA.
How to do opening the second link ( siteB ) opens in the same tab of the siteA ?
Please can you help me ?
Edit #01
browobj.Run start & siteB
Upvotes: 1
Views: 2803
Reputation: 2604
Since chrome is available as a command:
chrome /new-tab somesite.com
However if chrome
isnt available as a command but IS the default browser you can use:
start "" "https://somesite.com"
This should make it open in a new tab on the active window.
If you can't guarantee Chrome is the default browser. You can find the path to the chrome.exe and use something like:
"<Path of chrome here>" /new-tab "https://somesite.com"
Upvotes: 2