1

I need to handle the pop up Browser to allow the camera with Robot Framework. Like this https://i.stack.imgur.com/jcWnL.png

I am trying using the keyboard commands, I can go to allow button using the TAB but when I send Keys Press None ENTER isn't pressing Enter in the selected button (Allow button) but using the tab command in Firefox I can't access the allow button. I already tried this solution but doesn't work, don't allow the camera How to access microphone(camera) in robot framework?

Does someone know how to resolve this? I need a solution that works in Chrome and Firefox

Thiago
  • 33
  • 3
  • 9

1 Answers1

0

You could use Selenium with C#, Python, Java or JS. This option is also able to be used with Firefox and chrome. First, you'll have to pass in the configuration through to the profile, so once you're on a page which requires camera permissions, it will automatically have them granted. A simple python example below :)

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")

# 1 = Allow, 2 = Block
opt.add_experimental_option("prefs", { \
    "profile.default_content_setting_values.media_stream_mic": 1, 
    "profile.default_content_setting_values.media_stream_camera": 1,
  })

driver = webdriver.Chrome(chrome_options=opt)
driver.get('http://somesite.com)

Here a tutorial which will help you get up and running in no time https://help.crossbrowsertesting.com/selenium-testing/getting-started/python/

David Silveiro
  • 1,515
  • 1
  • 15
  • 23
  • Thank you for your answer @David-silveiro but how I use this in robot framework? I tried this way but didn't work: `*** Variables *** ${SiteOptionscam} Create Dictionary profile.default_content_setting_values.media_stream_camera": 1 ${desired caps} = Create Dictionary chromeOptions=${SiteOptionscam} *** Test Cases *** Test01 Open Browser ${url} Chrome desired_capabilities=${desired caps} Login action Click on the button that shows the pop up` Didn't allow the camera – Thiago Apr 09 '19 at 09:39
  • I think this might help if you didn't want to use Chrome Driver :) https://stackoverflow.com/questions/43389550/how-to-handle-web-based-alert-or-pop-ups-in-robot-framework – David Silveiro Apr 09 '19 at 11:39
  • Thank you so much, I already tried it before but didn't work, I must have done something wrong, but this time worked, thank you :) – Thiago Apr 09 '19 at 14:33
  • Do you know how I do it in Firefox too? – Thiago Apr 09 '19 at 14:56
  • I haven't really had much oppertunity to use the Robot framework so I can't really help there, but if there's chrome, you're probably in luck for Firefox also! If you found my answers helpful in anyway, when you get the chance, feel free to mark it :) – David Silveiro Apr 09 '19 at 16:34