Fix protocol conversion for getWindowHandle command
MODIFY
lib/jsonwp-proxy/protocol-converter.js
lib/jsonwp-proxy/protocol-converter.js
@@ -22,10 +22,16 @@ const COMMAND_URLS_CONFLICTS = [
},
{
commandNames: ['getWindowHandles', 'getWindowHandle'],
- jsonwpConverter: (url) => url.replace(/\/window\/handle(s?)$/,
- '/window_handle$1'),
- w3cConverter: (url) => url.replace(/\/window_handle(s?)$/,
- '/window/handle$1'),
+ jsonwpConverter: (url) => {
+ return /\/window$/.test(url)
+ ? url.replace(/\/window$/, '/window_handle')
+ : url.replace(/\/window\/handle(s?)$/, '/window_handle$1');
+ },
+ w3cConverter: (url) => {
+ return /\/window_handle$/.test(url)
+ ? url.replace(/\/window_handle$/, '/window')
+ : url.replace(/\/window_handles$/, '/window/handles');
+ },
},
];

Fix protocol conversion for getWindowHandle command (#265)