NassauSky Posted September 28, 2023 Share Posted September 28, 2023 (edited) Hi @Danp2 and all, Case scenario: User1 manually opens chrome and logs into website A (instance 1 of chrome) User1 starts an autoit script with webdriver UDF which it opens chrome and logs into website B (without closing instance 1 of chrome) User1 manually closes that 2nd instance How can I have Autoit sense that 2nd instance of chrome was shutdown and display a msgbox? Edited September 28, 2023 by NassauSky Link to comment Share on other sites More sharing options...
Danp2 Posted September 28, 2023 Share Posted September 28, 2023 What have you tried thus far? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NassauSky Posted September 28, 2023 Author Share Posted September 28, 2023 (edited) @Danp2 You read my mind. I was just posting: (This does not detect $sSession being removed) Global $sSession = _WD_CreateSession($sDesiredCapabilities) ;Global $sID = _WD_GetSession($sSession) ; Test but doesn't work If @error Then ConsoleWrite("Error creating WebDriver session: " & @error & @CRLF) Exit EndIf Global $handleTitle = _WD_Action($sSession, 'title') Global $Handle = WinGetHandle($handleTitle) Global $aHandlePos = WinGetPos($Handle) ConsoleWrite("!Initial $sSession: " & $sSession & @CRLF) ;ConsoleWrite("!Initial $sSessionID: " & $sSessionID & @CRLF) ; Doesn't work _WD_Navigate($sSession, "https://learnwebcode.github.io/practice-requests/") AdlibRegister("_CheckForChromeClose",1000) While 1 Sleep(20) Wend _WD_DeleteSession($sSession) _WD_Shutdown() Func _CheckForChromeClose() ConsoleWrite("$sSession: " & $sSession & " / " ) ;ConsoleWrite("$sSessionID: " & $sID & @CRLF) ;~ If StringLen($sSession)=0 Then ;~ MsgBox($MB_TOPMOST, "Session Closed", "The WebDriver session has been closed.") ;~ Exit ;~ EndIf EndFunc Edited September 28, 2023 by NassauSky Link to comment Share on other sites More sharing options...
Solution Danp2 Posted September 28, 2023 Solution Share Posted September 28, 2023 Take a look at _WD_Status and _WD_CheckContext. NassauSky 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now