如何让WebdriverIO switchWindow与Firefox一起使用

问题描述 投票:0回答:1

我正在学习使用 webdriverio,教程中的多个选项卡切换示例在 chrome 和 safari 中运行得很好,但在 firefox (v106) 中则不行。

这是代码:

describe('Manage multiple windows', function () {
    it('should switch to another tab', async () => {
        await browser.url('http://the-internet.herokuapp.com/windows')
        await (await $('.example a')).click()
        await browser.switchWindow('http://the-internet.herokuapp.com/windows/new')
        await expect(browser).toHaveTitle('New Window')
    })
})

我在日志中收到的错误是这样的:

[firefox 106.0.1 mac #0-0] No window found with title, url or name matching "http://the-internet.herokuapp.com/windows/new"
[firefox 106.0.1 mac #0-0] Error: No window found with title, url or name matching "http://the-internet.herokuapp.com/windows/new"
[firefox 106.0.1 mac #0-0]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[firefox 106.0.1 mac #0-0]     at async Context.<anonymous> (/Users/roni/code/tau/wdio7-tutorial/test/specs/switchWindow.test.js:7:9)

我尝试寻找答案,但找不到与此特定问题相关的太多内容。

在 webdriverio github 上找到了这个,但我认为这不是同一个问题:https://github.com/webdriverio/webdriverio/issues/7619

这是网络驱动程序、Mac 或 Firefox 问题吗? 有解决办法吗?

firefox webdriver-io selenium-firefoxdriver
1个回答
0
投票

我也有同样的问题,switchWindow 适用于 Chrome,但不适用于 Firefox。

© www.soinside.com 2019 - 2024. All rights reserved.