Skip to content

Commit f3c7cf0

Browse files
committed
fix: close window
1 parent a6854a8 commit f3c7cf0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/webdriverio/src/session/context.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class ContextManager extends SessionManager {
3636
* Listens for the 'closeWindow' browser command to handle context changes.
3737
* (classic + bidi)
3838
*/
39-
this.#browser.on('result', this.#onCommandResultBidiAndClassic.bind(this))
39+
// this.#browser.on('result', this.#onCommandResultBidiAndClassic.bind(this))
4040

4141
if (!this.isEnabled()) {
4242
return
@@ -58,23 +58,23 @@ export class ContextManager extends SessionManager {
5858

5959
removeListeners(): void {
6060
super.removeListeners()
61-
this.#browser.off('result', this.#onCommandResultBidiAndClassic.bind(this))
61+
// this.#browser.off('result', this.#onCommandResultBidiAndClassic.bind(this))
6262
this.#browser.off('command', this.#onCommand.bind(this))
6363
if (this.#browser.isMobile) {
6464
this.#browser.off('result', this.#onCommandResultMobile.bind(this))
6565
}
6666
}
6767

68-
#onCommandResultBidiAndClassic(event: { command: string, result: unknown }) {
69-
/**
70-
* the `closeWindow` command returns:
71-
* > the result of running the remote end steps for the Get Window Handles command, with session, URL variables and parameters.
72-
*/
73-
if (event.command === 'closeWindow') {
74-
this.#currentContext = (event.result as { value: string[] }).value[0]
75-
return this.#browser.switchToWindow(this.#currentContext)
76-
}
77-
}
68+
// #onCommandResultBidiAndClassic(event: { command: string, result: unknown }) {
69+
// /**
70+
// * the `closeWindow` command returns:
71+
// * > the result of running the remote end steps for the Get Window Handles command, with session, URL variables and parameters.
72+
// */
73+
// if (event.command === 'closeWindow') {
74+
// this.#currentContext = (event.result as { value: string[] }).value[0]
75+
// return this.#browser.switchToWindow(this.#currentContext)
76+
// }
77+
// }
7878

7979
#onCommand(event: { command: string, body: unknown }) {
8080
/**

0 commit comments

Comments
 (0)