Obtain session id of existing chrome session

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
drstuggi
Newbie
Posts: 9
Joined: Sun Feb 14, 2021 8:53 pm

Obtain session id of existing chrome session

Post by drstuggi » Sun Feb 14, 2021 8:59 pm

Hi. Is this possible? I need to click a chrome element in an existing session that has been automatically generated by a third party app. The url is unpredictable so I can’t use the chromestart function unfortunately

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Obtain session id of existing chrome session

Post by Dorian (MJT support) » Mon Feb 15, 2021 10:36 am

No, I'm afraid there isn't. These functions require that ChromeDriver is running and that ChromeDriver starts the Chrome browser session.

That said though, we could focus Chrome, copy the URL, and start another Chrome session. I'm not sure how viable that workaround is for you.

Code: Select all

//Edit this
Let>CHROMEDRIVER_EXE=c:\chromedriver.exe

//Focus Chrome
SetFocus>Obtain session*
WaitWindowFocused>Obtain session*
Wait>0.1

//Select the URL bar
Press alt
send>d
Release alt
Wait>0.1

//Copy it and assign it as a variable
Press ctrl
send>c
Release ctrl
Wait>0.1
getclipboard>TheURL

//Start and navigate Chrome
ChromeStart>session_id
ChromeNavigate>session_id,url,%TheURL%
Yes, we have a Custom Scripting Service. Message me or go here

drstuggi
Newbie
Posts: 9
Joined: Sun Feb 14, 2021 8:53 pm

Re: Obtain session id of existing chrome session

Post by drstuggi » Mon Feb 15, 2021 7:29 pm

Alright, thanks for the quick reply

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts