[Selenium] Change URL debug mode Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

[Selenium] Change URL debug mode

10 Feb 2020, 11:57

Hello,
can someone help me how to change URL with Selenium ?
already read This but still no luck
any help will be appreciated

this is my example code so far

Code: Select all

URL = https://www.autohotkey.com ; First URL
run % "chrome.exe --start-maximized -incognito --remote-debugging-port=9222" ( winExist("ahk_class Chrome_WidgetWin_1") ? " --new-window " : " " ) URL 
driver := ChromeGet()
MsgBox, % "First URL : `n" driver.Window.Title "`n" driver.Url
sleep, 10000
URL = https://www.autohotkey.com/docs/AutoHotkey.htm	; Second URL
run % "chrome.exe --start-maximized -incognito --remote-debugging-port=9222" ( winExist("ahk_class Chrome_WidgetWin_1") ? : " " ) URL 
driver := ChromeGet()
MsgBox, % "Second URL : `n" driver.Window.Title "`n" driver.Url

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

thank you
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

Re: [Selenium] Change URL debug mode  Topic is solved

10 Feb 2020, 23:35

Found it

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
URL1 = https://www.wikipedia.org/
URL2 = https://www.autohotkey.com/
URL3 = https://regex101.com/
URL4 = https://www.google.com
counting := 1
F1::
	if !WinExist("ahk_exe chrome.exe") {
		driver := ComObjCreate("Selenium.ChromeDriver")
		run % "chrome.exe --start-maximized -incognito --remote-debugging-port=9222"
		driver.SetCapability("debuggerAddress", "127.0.0.1:9222")
	}
	if counting between 1 and 4
	{
		ToolTip, % "Open URL " URL%counting%,5,5,1
		driver.Get(URL%counting%)
		MsgBox, % "Second URL : `n" driver.Window.Title "`n" driver.Url "`nCounting = " counting
		counting += 1
	}
	else
		counting := 1
return
Thank you

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 390 guests