Sam B
Sam B

Reputation: 33

Navigate to new page after logged in

Currently, I have this auto-login script:

set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("website.com", 1, false) 

WScript.Sleep 2000
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys "username"
WScript.Sleep 1000
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "password"
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
REM call WshShell.Run("http://website.com/pageineedtogoto", 1, false)

WScript.Quit()

Now I just need it to navigate to a new page but stay in the same tab.

By the way, all of this is plain, client-side VBScript, not in HTML or anything.

Upvotes: 1

Views: 348

Answers (1)

Bond
Bond

Reputation: 16311

Alt+D sets the focus to the address bar and highlights the text in all major browsers.

WshShell.SendKeys "%d"
WshShell.SendKeys "http://website.com/pageineedtogoto"
WshShell.SendKeys "{ENTER}"

You should really look into automating the InternetExplorer.Application class instead, however.

Upvotes: 1

Related Questions