Unable to luanch Chrome with " –use-fake-ui-for-media-stream" Switch, Anybody can help me>>

2,109 views
Skip to first unread message

rajendraprasad reddy

unread,
May 29, 2014, 1:02:52 AM5/29/14
to seleniu...@googlegroups.com

Hi All,

I am trying to automate a WebRTC (Real Time Communication) Application ,designed on HTML5 and it runs on Chrome browser .
In this application i need to access and capture the input from the Microphone or Camera from web application.

When i click on capture button, chrome is showing info bar(a kind of popup alert) with “allow” and “deny” options., Since this info bar i cannot handle with Selenium web driver.

After doing some research i came to know that, If i manually launch chrome browser from command line with a switch “–use-fake-ui-for-media-stream” chrome is allowing to access the camera without info bar.

Example: C:\Users\user>start chrome –use-fake-ui-for-media-stream

 

But if try the same with simple web driver script i am still getting the info bar with same allow and deny options how to suppress this info bar as it worked manual chrome browser launch from command line? :
here is my code:

import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class UseChromeSwitch {
public static void main(String[] args) throws IOException {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(“chrome.switches”,Arrays.asList(“use-fake-ui-for-media-stream”));;
RemoteWebDriver driver1 = new RemoteWebDriver(new URL(“http://127.0.0.1:4444/wd/hub”), capabilities);
driver1.get(“http://www.html5rocks.com/en/tutorials/getusermedia/intro/”);
driver1.findElement(By.id(“capture-button”)).click();
}
}


Note Before running above code you need to run the from command line:
java -Dwebdriver.chrome.driver=”C:\chromedriver.exe” -jar “C:\selenium-server-standalone-2.41.0.jar”

Note: Please try this on laptop which has built-in camera otherwise you cannot access the camera.

Thanks,
Rajendra

Krishnan Mahadevan

unread,
May 29, 2014, 2:56:27 AM5/29/14
to Selenium Users
AFAIK, you should be passing the switches to chrome browser via this approach :


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a3a2dc83-588b-43c5-bf63-9737181e82bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages