"chrome.window.onRemoved.addListener()" does not executes when webdriver.quit() in Python



  • I want to perform logic on chrome.window.onRemoved.addListener(), it works exactly in chrome browser development environment and in selenium when performed with browser UI of selenium test, but when I execute driver.quit(); in python shell the onRemoved event is not performed.

    How can I trigger chrome browsers window.onRemoved/(any event before window close to get handled in the extension) event in selenium test while applying Webdrive.quit();?



  • Refer to this question:

    https://stackoverflow.com/q/34152390/6793637

    chrome.window.onRemoved.addListener(), works only when a chrome process is running. The `driver.quit()` closes all the  chrome processes.
    

    Use driver.close()

    or

    Could you try this :

    // Initializing instance of Firefox WebDriver
        driver = new ChromeDriver();
        wait = new WebDriverWait(driver, waitTime);
    
    // Initializing EventFiringWebDriver using Firefox WebDriver instance
        e_driver = new EventFiringWebDriver(driver);
    
    
    //create object of EventListerHandler to registeritwithEventFiringWebDriver
            eventListener = new WebEventListener();
    
            e_driver.register(eventListener);
    
            e_driver.manage().window().maximize();
            e_driver.get(appURL);
            e_driver.Quit()
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2