简体   繁体   中英

Catch the closing event of the chrome browser using chrome driver

I am doing the automation in an application for some web pages in the vb.net using the chrome driver.

During the application operation here is a chance that chrome may close before completion of automation process (user may close or chrome may crash).

Now my requirement is that if the chrome is closed by the user while automation is running, the application needs to know that a close event in chrome is raised by the user and the application needs give a Yes/No message with the custom text to confirm the action of the user.

I searched this for some time on the internet and found nothing. Please provide the way to catch the closing event of the chrome browser in vb.net using the chrome driver.

Not sure I quite understand the question, but can you use the window.onbeforeunload approach?

eg See W3Schools

$(document).ready(function () {
    window.onbeforeunload = function () {
        //your code here
    };
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM