-1

I am working on robot framework where in i am not able to allow chrome camera allow popup from the browser. Please help on this or code will help a lot.

enter image description here

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
Mohan
  • 1
  • 1
  • Hello! I don't know `robotframework`, but it seems to me that the description of your issue is really short and nobody will be able to help you with no further information: browser version, computer OS and version, etc. – Joël Nov 27 '18 at 13:00
  • Welcome to [so] where we aim to assist you with your programming difficulties. A good question contains certain information as described in the [ask] section of the [help]. Chief among them is the [mcve]. If you have tried several approaches, it helps to highlight them and the observed results. This prevents unnecessary questions for clarifications and probably increases the number of answers and their suitability for your specific situation. – A. Kootstra Nov 27 '18 at 13:25

3 Answers3

4

Need to create webdriver with preferences which allows microphone (--use-fake-ui-for-media-stream)

Similar question solution is explained here how to handle web based alert or pop ups in robot framework?

Java or python related solution explained here How do i allow Chrome to use my microphone programatically?

Snippet:

Chrome With Preferences
    ${chrome_options} =     Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver

    &{SiteOptions}         Create Dictionary    last_used=${1470931206}     setting=${1}
    &{media_stream_mic}    Create Dictionary    https://www.google.nl:443,*=${SiteOptions}
    ${prefs}               Create Dictionary    profile.content_settings.exceptions.media_stream_mic=${media_stream_mic}

    Call Method    ${chrome_options}    add_experimental_option    prefs    ${prefs}

    Create WebDriver    Chrome    chrome_options=${chrome_options}
0

Below is the sample code -

${chrome_options}=  Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()   sys
Call Method ${chrome_options}   add_argument    --use-fake-ui-for-media-stream
Call Method ${chrome_options}   add_argument    --use-fake-device-for-media-stream
Create Webdriver    Chrome  alias=tab1  chrome_options=${chrome_options}
Dev
  • 2,739
  • 2
  • 21
  • 34
zare
  • 1
  • where to pass the chrome_options? to the open browser command? Can you please help with the next command to open the browser as well? – Jivan Sep 29 '21 at 12:31
0

*** Settings ***

Library SeleniumLibrary Library BuiltIn

#Test Setup Test Case Setup

*** Test Cases *** Test Site Login

  ${chrome_options}=Evaluate sys.modules['selenium.webdriver'].ChromeOptions()   sys

Call Method      ${chrome_options}   add_argument    --use-fake-ui-for-media-stream

Call Method         ${chrome_options}   add_argument    --use-fake-device-for-media-stream

Create Webdriver    Chrome  alias=tab1  chrome_options=${chrome_options}

Open Browser     https://www.google.com/  Chrome     alias=tab1

Click Element    xpath://div[@aria-label='Search by voice']//*[name()='svg']

This is the code which we can use for the purpose of enabling the mic in www.google.com