问题
I'm using Behat with Mink.
Currently I'm working on building a test for webrtc. The issue is that webrtc has a browser permission dialog where the user has to select that they do want to share their media. As this permission is from the browser itself instead of html I don't know how to accept it with mink or even if that's possible.
Is there any work around or standard solution for this? I imagine the same issue holds true for anything a browser requires user permissions to use.
回答1:
Option 1: It feels like a bit of a "sledgehammer to crack a nut", but the main answer I can find is to automate this with something like AutoIt:
You have to prepare AutoIt such, that it waits for any browser download dialog, the point at which Selenium is giving up, takes control of the window, saves the file, and closes the window. After that Selenium can continue as usual.
(source)
I've not tried this myself, so can't give a more detailed answer, I'm afraid.
Option 2: You might think that you could simply set up the browser in question to always accept those requests, but it looks like this setting may not affect Selenium (at least not with Chrome, not sure about Firefox). If you could figure out why that was - or if it does work in FF -, that might be a simpler fix!
来源:https://stackoverflow.com/questions/20613828/accept-browser-permission-dialog-with-behat-mink