How to access microphone(camera) in robot framework?

我的未来我决定 提交于 2019-12-20 06:41:23

问题


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.


回答1:


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}



回答2:


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}


来源:https://stackoverflow.com/questions/53500111/how-to-access-microphonecamera-in-robot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!