1

I've been trying to get protractor to accept the browser local camera by using

browser.actions().sendKeys(protractor.Key.TAB, protractor.Key.TAB, protractor.Key.ENTER).perform();

This tabs to the accept button properly, but the enter key never gets submitted. I've also tried using

browser.actions().sendKeys(protractor.Key.TAB, protractor.Key.TAB).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();

thinking that maybe enter needed to be on it's own line.

Any ideas on this?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
pedalpete
  • 21,076
  • 45
  • 128
  • 239

2 Answers2

5

You can try to manipulate the question popup using switchTo(), but I am afraid this is not going to work since this is a native chrome popup and not a javascript alert:

 browser.driver.switchTo().alert().accept();

Here are the options (not tested yet):


Also, have you tried pressing TAB 3 times?

browser.actions().sendKeys(protractor.Key.TAB, protractor.Key.TAB, protractor.Key.TAB, protractor.Key.ENTER).perform();
Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • Unfortunately none of these solutions have worked for me. The strange thing is that I can see that pressing TAB twice activates the correct tab button, but ENTER isn't doing anything. – pedalpete Dec 04 '14 at 22:33
  • @pedalpete that's ok, let see what other options there are. Can you share a link where this question popup shows up so I can debug it? Thanks. – alecxe Dec 05 '14 at 00:24
  • I was trying to use a combination of `videoCaptureAllowedUrls` and args, but apparently the allowedUrls was breaking the args. Removing that and just using `--use-fake-ui-for-media-stream` worked in the end. Thanks. – pedalpete Dec 05 '14 at 02:28
  • 1
    Apparently you now need to exclude the `--` of the arguments. `-–use-fake-ui-for-media-stream` didn't work for me but `use-fake-ui-for-media-stream` did work. – wwv Jun 23 '15 at 20:36
  • @wwv yeah, I'm actually using it without the `--` :) Thank you for noticing! – alecxe Jun 23 '15 at 20:38
  • Hi there! So what is the final solution here, it is marked with a green tick, but none of your comments is working for me. Thx. – Andrej Sep 08 '16 at 17:40
0

Try this:

capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
     args: ['--use-fake-device-for-media-stream','--use-fake-ui-for-media-stream'],
    }
  },
Andrej
  • 558
  • 6
  • 14