如何在使用 cucumber-capybara(selenium -chromeDriver) 测试时允许弹出相机权限
我有链接将打开一个新页面来执行某些任务。只有在允许相机权限后我才能进一步进行。
弹出窗口
首先会出现一个确认弹出窗口,询问相机权限。单击“允许”按钮后,会出现浏览器权限弹出窗口。 它与我们访问任何网站时出现的所有弹出窗口类似
我有一个用 Gherkin 语法编写的功能文件和一个使用水豚语法编写的步骤定义文件。
步骤定义
Then('I click test link') do
test_window = window_opened_by do
find(:css, "a[href='example.com/test']").click()
# sleep(5)
end
within_window test_window do
click_button 'Allow'
end
sleep(10)
end
单击“允许”按钮后,会出现浏览器权限弹出窗口。请检查附件图像。 我需要获得该许可。有人可以建议如何使用 capybara-cucumber 和 selenium chromeDriver 来做到这一点。
如果你知道我如何在 cypress 中做同样的事情,请提出建议。赛普拉斯不允许摄像头许可。我已经使用过 npm 模块,但它对我不起作用。 还有其他替代方法可以做同样的事情吗?
I have link that will open a new page to do some task. I can only proceed further only after allowing camera permissions.
popup window
First a confirmation popup appears which ask for camera permissions. After clicking on allow button browser permission popup appears.
it's similar to all pops that appears when we visit any website
I have a feature file written in Gherkin syntax and a step definition file written using capybara syntax.
step definition
Then('I click test link') do
test_window = window_opened_by do
find(:css, "a[href='example.com/test']").click()
# sleep(5)
end
within_window test_window do
click_button 'Allow'
end
sleep(10)
end
After clicking allow button browser permission pop appears.Please check the attached images.
I need to allow that permission. can someone suggest how to do that using capybara-cucumber with selenium chromeDriver.
If you have any idea how i can do the same thing in cypress please suggest. Cypress is not allowing camera permission. I have already used a npm module but it didn't worked for me.
Any other alternative to do the same ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试添加
--use-fake-ui-for-media-stream
或--use-fake-device-for-media-stream
参数设置所需的功能?have you tried to add the
--use-fake-ui-for-media-stream
or--use-fake-device-for-media-stream
argument when you set the desired capabilities?