What would cause chromedriver to disconnect from selenium after window.close()?

127 views
Skip to first unread message

Sam Kidman

unread,
Jan 19, 2023, 7:51:10 PM1/19/23
to ChromeDriver Users
Hello

We're observing a flaky test in our browser automation suite that appears to be caused by chromedriver closing the connection with selenium, and we were wondering if it's something to do with the way chromedriver handles closing tabs. We think chromedriver might be exiting the chrome process altogether instead of just closing one tab.

The chromedriver connection is closed after our test closes a tab via a button that runs window.close().

Most of the time however, the connection remains open and our test suite works normally.

When the connection is closed the rest of the tests in our suite fail.

I've attached debug logs from chrome driver for an instance of this occurring here.

The tab is first opened on this log line:
[1674174010.232][INFO]: [e22779aeebb3438c9b85b8722654ba80] COMMAND ClickElement {
   "id": "434e1478-55db-4dca-ba23-9b82dc63ede1"
}

And the click that seems to close everything is here:
[1674174011.899][INFO]: [e22779aeebb3438c9b85b8722654ba80] COMMAND ClickElement {
   "id": "24d12ae4-2ad8-4337-8427-abd0cacb9b7e"
}

Jesse Brown

unread,
Jan 19, 2023, 8:45:09 PM1/19/23
to Sam Kidman, ChromeDriver Users
Looks like the call is being redirected to the parent window.

--
You received this message because you are subscribed to the Google Groups "ChromeDriver Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromedriver-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chromedriver-users/b4290e7b-6340-4cc5-b606-abcb44691616n%40googlegroups.com.

Sam Kidman

unread,
Jan 19, 2023, 9:34:19 PM1/19/23
to ChromeDriver Users
How can we guarantee the call is always directed to the tab?

To be clear, our test does normally something like this:
1. Open a page
2. Click a link that opens a tab
3. Do some things in the new tab
4. Close the new tab
5. Continue on the original page

But if the window.close() is redirected to the parent window:
1. Open a page
2. Click a link that opens a tab
3. Do some things in the new tab
4. Close the new tab, which closes the window
5. Rest of our specs fail

Jesse Brown

unread,
Jan 19, 2023, 9:54:11 PM1/19/23
to Sam Kidman, ChromeDriver Users
Thinking about it the message is passing to the parent window but it's not delegating to the child.

Jesse Brown

unread,
Jan 19, 2023, 9:54:55 PM1/19/23
to Sam Kidman, ChromeDriver Users
So it's actually Chrome.

Jesse Brown

unread,
Jan 20, 2023, 4:46:56 AM1/20/23
to Sam Kidman, ChromeDriver Users
But you should ensure the tab is selected first.
Reply all
Reply to author
Forward
0 new messages