Chrome Closed after Complete Script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
rizwan4season
Posts: 15
Joined: 13 Nov 2020, 08:37

Chrome Closed after Complete Script

26 Dec 2020, 01:57

Code: Select all

driver:= ComObjCreate("Selenium.WebDriver")
Driver.Start("chrome", "https www.EXAMPLE.COM /")  Broken Link for safety
driver.Get("/")
driver.findElementByID("txtLogin").SendKeys("XI2DC")
driver.findElementByID("txtPassword").SendKeys("HELI")
click:
Loop
{
	driver.findElementByID("imgbtnLogin").click
	try
		Exists := driver.findElementByID("lblError").Attribute("innerText")
	catch
		break
	Sleep 500
}
return
[Mod edit: [code][/code] tags added.]
why Chrome closed after complete this script
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: Chorme Closed after Complete Script

26 Dec 2020, 04:22

Hi @rizwan4season, does Driver.Start("chrome", "https www.EXAMPLE.COM /") ;Broken Link for safety make any difference?
Otherwise, Chrome may treat that as some kind of command line argument.
I would also place the Sleep before the try/catch:

Code: Select all

Loop
{
	Sleep 500
	driver.findElementByID("imgbtnLogin").click
	try
		Exists := driver.findElementByID("lblError").Attribute("innerText")
	catch e
		break
}
Does Exists ever hold a non-empty string?
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
gregster
Posts: 9014
Joined: 30 Sep 2013, 06:48

Re: Chorme Closed after Complete Script

26 Dec 2020, 04:36

lmstearn wrote:
26 Dec 2020, 04:22
Hi @rizwan4season, does Driver.Start("chrome", "https www.EXAMPLE.COM /") ;Broken Link for safety make any difference?
Otherwise, Chrome may treat that as some kind of command line argument.
That's just caused by the forum's saftey features - new users can only post links to whilelisted websites. Other links will be mutilated like this.
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: Chrome Closed after Complete Script

26 Dec 2020, 21:41

gregster wrote:
lmstearn wrote:
26 Dec 2020, 04:22
That's just caused by the forum's saftey features - new users can only post links to whilelisted websites. Other links will be mutilated like this.
Good to know, thanks.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ht55cd3 and 264 guests