0

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();?

1

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()
| improve this answer | |
0

Did you try driver.close()?

Quit() kills the browser, which probably does not give it the chance the trigger the events. Close() closes the active window but the browser stays open, although if it is the last window it might quit aswell, maybe you need to open an extra window first.

| improve this answer | |
  • yes, on using driver.close() it quits browser as it is only the window. Also I tried to use key commands ALT + F4 but it is also not working. – Abhishek Kumar Jan 23 at 18:10
  • After brainstorming on this so much I concluded that there at in this case derivr.quit() is not real implementation of closing chrome browser like real browser, and it must be improved. – Abhishek Kumar Jan 23 at 18:14
  • thanks for taking look @Neils van – Abhishek Kumar Jan 23 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.