--use-file-for-fake-audio-capture doesn't play on google.com - selenium

I am trying to make an audio file play on google.com. I have the following code:
ChromeOptions options = new ChromeOptions();
options.AddArguments(
//"--allow-file-access-from-files",
"--use-fake-ui-for-media-stream",
//"--allow-file-access",
"--use-file-for-fake-audio-capture=" + AppDomain.CurrentDomain.BaseDirectory + "/audio.wav",
"--use-fake-device-for-media-stream"
);
IWebDriver chrome = new ChromeDriver(options);
this code opens a chrome window with the use of selenium in C# and everything works as expected. When i go to an online audio recorder or https://appr.tc/?debug=loopback then my audio file plays just like it is supposed to do. However, when i go to google.com and I click on the search by voice button at the end of the searchbar nothing happens. (when I just talk then google.com recognizes my voice) What am I missing and why doesn't it work? I am trying to recreate this but in C# http://www.testautomationguru.com/selenium-webdriver-google-voice-search-automation-using-arquillian-graphene/. Is there some kind of javascript code I could execute on the page to make it work? I wouldn't mind using a firefoxdriver instead of a chrome one if that solves the problem.
Thanks
Edit: I found a little more information on https://webrtc.org/testing/ so I suppose this means that google.com doesn't make use of the webrtc getUserMedia() call to get the audio? Any way I could modify the page so it does or can I change some other setting? I also just checked https://speechnotes.co/ and on that site my audio also isn't detected but my real microphone is.

google.com makes use of webKitSpeechRecognition() in javascript which is the built in chrome speech recognition, checkchrome speech recognition WebKitSpeechRecognition() not accepting input of fake audio device --use-file-for-fake-audio-capture or audio file

Related

How to recording current screen(not open popup) and audio by muaz-khan WebRTC-Experiment webrtc

muaz-khan WebRTC-Experiment
How to edit the extension to be as I want
Thanks
No its not possible to do within browser, its the matter of end user privacy.
You can build your own native Windows/Mac application to get rid of this
Chrome is providing screen/window/tab capturing through chooseDesktopMedia API, it is available only from chrome extension and we cant call this API from web app.
That demo extension is showing how to use chooseDesktopMedia.
We have no control on the screen selection popup, we can only choose the
combination of screen/window/tab/audio with the DesktopCaptureSourceType

HtmlUnitdriver issues with Ajax content, I think

I have been testing an app using Firefox Web Driver but it is really slow comparing with HtmlUnitdriver, so I decided to translate to last one. All works fine but I have problems with some kind of links that loads information async.
In my case it is not problem of "wait" because I do and as i said before, using Firefox driver works very well. But with HtmlUnit doesnt work well.
In my scene I have following code:
Send
Viewing the app on a browser such as Firefox, when I click on that link, the system return me a result. But when I use HtmlUnitdriver, when I do click to the element, the driver goes directly to the href and then I have a bad result.
I don't really know how to do make works with it. I'm really interested on this way because is really fast.

Screen sharing with WebRTC?

We're exploring WebRTC but have seen conflicting information on what is possible and supported today.
With WebRTC, is it possible to recreate a screen sharing service similar to join.me or WebEx where:
You can share a portion of the screen
You can give control to the other party
No downloads are necessary
Is this possible today with any of the WebRTC browsers? How about Chrome on iOS?
The chrome.tabCapture API is available for Chrome apps and extensions.
This makes it possible to capture the visible area of the tab as a stream which can be used locally or shared via RTCPeerConnection's addStream().
For more information see the WebRTC Tab Content Capture proposal.
Screensharing was initially supported for 'normal' web pages using getUserMedia with the chromeMediaSource constraint – but this has been disallowed.
EDIT 1 April 2015: Edited now that screen sharing is only supported by Chrome in Chrome apps and extensions.
You guys probably know that screencapture (not tabCapture ) is avaliable in Chrome Canary (26+) , We just recently published a demo at; https://screensharing.azurewebsites.net
Note that you need to run it under https:// ,
video: {
mandatory: {
chromeMediaSource: 'screen'
}
You can also find an example here; https://html5-demos.appspot.com/static/getusermedia/screenshare.html
I know I am answering bit late, but hope it helps those who stumble upon the page if not the OP.
At this moment, both Firefox and Chrome support sharing entire screen or part of it( some application window which you can select) with the peers through WebRTC as a mediastream just like your camera/microphone feed, so no option to let other party take control of your desktop yet. Other that that, there another catch, your website has to be running on https mode and in both firefox and chrome the users are gonna have to install extensions.
You can give it a try in this Muaz Khan's Screen-sharing Demo, the page contains the required extensions too.
P. S: If you do not want to install extension to run the demo, in firefox ( no way to escape extensions in chrome), you just need to modify two flags,
go to about:config
set media.getusermedia.screensharing.enabled as true.
add *.webrtc-experiment.com to media.getusermedia.screensharing.allowed_domains flag.
refresh the demo page and click on share screen button.
To the best of my knowledge, it's not possible right now with any of the browsers, though the Google Chrome team has said that they're eventually intending to support this scenario (see the "Screensharing" bullet point on their roadmap); and I suspect that this means that eventually other browsers will follow, presumably with IE and Safari bringing up the tail. But all of that is probably out somewhere past February, which is when they're supposed to finalize the current WebRTC standard and ship production bits. (Hopefully Microsoft's last-minute spanner in the works doesn't screw that up.) It's possible that I've missed something recent, but I've been following the project pretty carefully, and I don't think screensharing has even made it into Chrome Canary yet, let alone dev/beta/prod. Opera is the only browser that has been keeping pace with Chrome on its WebRTC implementation (FireFox seems to be about six months behind), and I haven't seen anything from that team either about screensharing.
I've been told that there is one way to do it right now, which is to write your own webcamera driver, so that your local screen appeared to the WebRTC getUserMedia() API as just another video source. I don't know that anybody has done this - and of course, it would require installing the driver on the machine in question. By the time all is said and done, it would probably just be easier to use VNC or something along those lines.
navigator.mediaDevices.getDisplayMedia(constraint).then((stream)=>{
// todo...
})
now you can do that, but Safari is different from Chrome in audio.
it is Possible I have worked on this and built a Demo for Screen share. During this watcher can access your mouse and Keyboard. If he moves his mouse then Your mouse also moves and if he types from his Keyboard, it will be typed into your pc.
View this code this code is for Screen share...
Right now in this days you can share screen with this, you not need any extentions.
const getLocalScreenCaptureStream = async () => {
try {
const constraints = { video: { cursor: 'always' }, audio: false };
const screenCaptureStream = await navigator.mediaDevices.getDisplayMedia(constraints);
return screenCaptureStream;
} catch (error) {
console.error('failed to get local screen', error);
}
};

How to play & pause video using Selenium?

Can anyone help me with how to automate play/pause video present on the web page using Selenium..
Thanks in advance...
This is extremely dependent on the browser and the player handling the video. You'll need to use the JavaScript executor, most likely.
I was discussing this last night with a pal and he came up with the following example using the Python variant of Webdriver for a demo video from html5demos.com:
driver = webdriver.Firefox()
driver.get("http://html5demos.com/video")
driver.execute_script('document.getElementsByTagName("video")[0].play()')
You can also "pause" where the "play" is used.
There's a larger question here: what are you actually trying to verify? That simply playing and pausing doesn't throw any errors? Make sure you know what you're validating and that it makes sense to actually work to automate the video test versus just leaving that particular use case to a manual test. (Though you could use the above script to get you to that point!)
** EDIT: Check out this bit of Python code (not mine) which exposes a "Paused" property. Now you could at least validate video loads, starts, and can be stopped. I'm still skeptical of the use of this sort of test, but at least it's a start.
By Using FlashObjectwebDriver !
Now what is FlashObjectWebDriver ?
FlashObjectWebDriver is an interface under Webdriver Library.
FlashObjectWebDriver has a Method called : callFlashObject
callFlashObject method can be over loaded using arguments ie.
callFlashObject(“Play”) : For Playing the Flash
callFlashObject(“Pause”) : For Pausing the Flash
callFlashObject(“Previous”) : For playing previous Flash video
callFlashObject(“next”) : For playing next Flash video
callFlashObject(“SetVariable”, “/:Message) : For displaying the message .
Implementation :
FlashObjectWebDriver flashApp = new FlashObjectWebDriver(driver, "myFlashMovie");
// Pass the URL of video
driver.get("http://demo.guru99.com/flash-testing.html");
Thread.sleep(5000);
flashApp.callFlashObject("Play");
Thread.sleep(5000);
flashApp.callFlashObject("StopPlay");
Thread.sleep(5000);
flashApp.callFlashObject("SetVariable","/:message","Flash testing using selenium Webdriver");
System.out.println(flashApp.callFlashObject("GetVariable","/:message"));

How to work with video in selenium-webdriver?

I have some videos and I want to test their with automation.
Could you tell, how does selenium-webdriver work with video?
How does it recognize it?
Selenium can test if the correct elements are in the DOM for video. You won't really be able to interact with the video with Selenium. You many need to record the network traffic to check the relevant items are being downloaded or if they 404.
I use WebdriverJS to click on youtube video.
I have tested the methods below and found them to work.
.click("#videoid")
.click("iframe:hover")
.click(".classname")
This of course is a little surprising as Selenium is not supposed to work with flash...