$(document.activeElement).attr('id') on input range don't work on mobile - input

I try to get the element id of an input type range with the $(document.activeElement).attr('id') function.
It's work on desktop but don't on mobile (android device, chrome browser).
Is there any solution to make that ?
Thanks a lot.
var activeElement = $(document.activeElement).attr('id');

Related

How can you ask for an alternative video input in Safari?

To get an alternative video input from MediaDevices.getUserMedia, my understanding is that you need to pass in the deviceID as a constraint. But, in Safari, to get access to deviceIDs via enumerateDevices, I need to call getUserMedia and get permission from the browser first (maybe there's another way?). The problem is that this initial getUserMedia call only returns device info for devices I've given permission for, so I still don't have the deviceID of the alternative video input.
How can I get the deviceID for this video input?
In my case, I'm trying to find the deviceID for Snapchat's "Snap Camera". In Chrome, I'm able to find and stream this video input.

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

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

Selenium - Element not visible when the browser set to mobile responsive mode

I am testing the browser for mobile responsiveness. I changed the browser window size to iPhone 5 which is 320 x 568 using this command
driver.Manage().Window.Size = new Size(320, 568);
When I run the test, the browser opens fine according to the mentioned size without any issue. But it fails to find a hyperlink text which is displayed on the page. I get Element not visible exception when I could actually see the link text on the screen. So, could anyone help me solve this issue or have any ideas that I could try?
Any help would be highly appreciated.
Thanks.
Perhaps it's due to the time delay, that means code executes even before the link appears, So write the following code in your language
Code from Ruby Selenium-binding
wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds
wait.until { driver.find_element(id: "foo").displayed? }
driver.find_element(id: "foo").click
Try to scroll to the element.
You could use java script to do that.
In Python this can be done via
WebDriver.execute_script("arguments[0].scrollIntoView();", elem)
Some elements of the DOM of the webpage change when you test for mobile responsiveness, so selenium is unable to locate the element that you are specifically trying to target.So, you should try to debug and find the methods where the code is failing to perform the action.Then you should find the locators for those elements in "mobile responsiveness view" and trigger only those methods when you are testing for mobile.

VB.net viewing IP CAM using WebBroswer

I am trying to view a IP CAM and displaying it in a WebBroswer, but i keep geting an error.
Here is the code im using.
Dim z As String = "http://ip_address/mjpeg?res=half&x0=0&y0=0&x1=1600&y1=1200&quality=12&doublescan=0&sei=on%20HTTP/1.1\r\n%20Host:%20ip_address\r\n\r\n"
WebBrowser1.Navigate(z)
Internet Explorer is unfortunately the base for the web browser component in win forms. In turn by default it will not understand the MJPEG file format so will ask you to download the file.
Try using chromium (open source chrome) as it should handle this file format.
https://thechriskent.com/2014/08/18/embedded-chromium-in-winforms/
Alternatively you could look at the options here: Cross-browser solution for displaying MJPEG stream as you maybe able to wrap it in another way

jQuery Mobile disables Mobile Safari's AutoFill

this is specifically about MOBILE SAFARI. let's not discuss other browsers.
alright, i've got a form that works with Safari's AutoFill on the mac, it also works in a Mobile Safari if i remove jQuery Mobile. however, as soon I have jQuery Mobile firing, the AutoFill button/feature in mobile Safari stops responding. the "AutoFill" button is greyed out.
can anyone explain this?
thanks
** UPDATE / ~ANSWER **
jQuery Mobile [v1.0a4.1] just up and sets:
this.setAttribute("autocomplete", "off");
on
var textInputs = allControls.filter( "input[type=text]" );
...which makes all the difference.
see: https://github.com/jquery/jquery-mobile/issues/785
I believe I read that this was updated in version 1.1, and this was fixed.
If its not, there's no reason why you shouldn't be able to reset it where you need it, either on a per page basis, or globably ...
PER PAGE:
$(document).delegate('yourpage','pageinit',function(){
$(‘input[type=text]‘).attr(‘autocomplete’,'on’);
});
GLOBAL:
$(document).bind('mobileinit',function(){
$(‘input[type=text]‘).attr(‘autocomplete’,'on’);
})
autocomplete on fix came from http://ranservices.com/2011/11/jquery-mobile-breaks-autofill-on-iphone/