WebDriverError: Unknown error, while opening second edge window using Selenium(Javsacript)

WebDriverError: Unknown error, while opening second edge window using Selenium(Javsacript)

我正在使用 selenium 为边缘浏览器创建自动化工具,我需要在其中使用三个不同的 URL 并行打开三个边缘 window。 第一个 Edge 浏览器 window 成功启动,但是当为第二个 url 调用函数 openEdgeBrowser 时,它抛出异常:WebDriverError:未知错误.

const webdriver = require('selenium-webdriver');
const edgedriver = require('edgedriver');
const edge = require('selenium-webdriver/edge');


var openEdgeBrowser = async function(url){

    try {
        let edgeService = await new edge.ServiceBuilder(edgedriver.path);
        let browser = await new webdriver.Builder().forBrowser('MicrosoftEdge').setEdgeService(edgeService).build();
        await browser.get(url);
        console.log('Browser launched successfully with url: ' + url);
    } catch(e) {
        console.log.end(`Error in launching edge browser, Exception: ${e}`);
    }
};

我希望 运行 Edge 的三个实例在一起。

问题是Edge不支持多实例:

Hi, This is a known issue.

I just checked the Feedback Hub and I only see a Microsoft internal posting for this issue. Will you add this to the Feedback Hub? Open the Feedback Hub app by using the Search Bar (Win + s) and typing “feedback hub”

The only workaround I am aware of is to use Selenium grid with multiple Windows Clients. The Clients can be Hyper-V instances.

Appreciate you reporting this issue and wish I had a better answer for you. :-/ Steve

https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17754737/

推特上也有同样的评论。

https://twitter.com/instylevii/status/783480823445987329

我找不到任何迹象表明此错误已得到修复,因此我假设它仍然未解决。它在版本 41.16299.15.0 中肯定仍然很出色,我在发行说明中找不到任何提到版本 42 中的修复的内容。