Autohotkey with Selenium - Switch Chrome Tab? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Axxi
Posts: 15
Joined: 02 Apr 2020, 10:56

Autohotkey with Selenium - Switch Chrome Tab?

09 Apr 2020, 11:31

Hi!

I've been playing around with Selenium for chrome and ive managed to automate some really annoying tasks. I can connect to an already open chrome instance, the problem is switching between tabs, i just cant find the command to do that (idk if its even possible). I wanna be able to switch tabs to an exact website, i know there are some solutions where you just use input ctrl+tab, but would like to have more control over it if possible.

Would very much appreciate answers if someone has any knowledge about this.

Thanks in advance!
User avatar
Yakshongas
Posts: 575
Joined: 21 Jan 2020, 08:41
Facebook: Yakshongas

Re: Autohotkey with Selenium - Switch Chrome Tab?

09 Apr 2020, 11:49

Just use Control & "any number here":: to switch between specific tabs.
Example.
Control & 1 switch to tab 1
Control & 5 switch to tab 5
and so on.
Please mark your topics as solved if you don't need any further help. ✅

Need a little more help? Discord : Yakshongas#9893 🕹
Axxi
Posts: 15
Joined: 02 Apr 2020, 10:56

Re: Autohotkey with Selenium - Switch Chrome Tab?  Topic is solved

09 Apr 2020, 11:55

Hey Yakshongas!

Thank you for your suggestion, while it works, I even found a better solution once i found the api documentations for the chromedriver (located in the C:\Program Files\SeleniumBasic folder).

I will post my code below to find the window title of current chrome tab and the code to switch to it, hopefully this might help someone else who was in same position.

Code: Select all

driver := ChromeGet()
msgbox % driver.title
driver.SwitchToWindowByTitle("TITLE NAME")



ChromeGet(IP_Port := "127.0.0.1:9222") {
	driver := ComObjCreate("Selenium.ChromeDriver")
	driver.SetCapability("debuggerAddress", IP_Port)
	driver.Start()
	return driver
}

Yakshongas wrote:
09 Apr 2020, 11:49
Just use Control & "any number here":: to switch between specific tabs.
Example.
Control & 1 switch to tab 1
Control & 5 switch to tab 5
and so on.

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], littlegandhi1199, tatagi and 36 guests