ChromeDriver touch events always disabled - webdriver

I'm trying to lauch Chrome browser with touch events enabled, however when it always stats with touch events disabled (touch events doesn't work and "Emulate touch events" checkbox is not checked in "Dev. tools" -> Settings -> Overrides)
My code is:
ChromeOptions opt = new ChromeOptions();
opt.addArguments("touch-events");
WebDriver driver = new ChromeDriver(opt);
Is there any way to launch Chrome with Touch Events enabled?

I think you're confusing two settings. First there's whether or not the browser supports the touch event APIs. That's controlled by the -touch-events flag (enabled, disabled or automatic which means enabled if a touch screen is detected). When it is true, you'll see, for example ('ontouchstart' in window) is true (and many other properties/function exists).
Secondly there is a devtools feature which generates synthetic touch events from mouse input. This technically works regardless of whether the touchy APIs are enabled (but some sites may legitimately be confused if some touch APIs don't exist, yet they receive touch events). As far as I know, there is no way to enable the developer tools and turn on a feature from the command line.

This should do the trick
opt.addArguments("--touch-events=disabled");

Related

How can I disable the Android 11 media notification for my application when using ExoPlayer's media2 extension?

I have an application that plays videos using ExoPlayer. A notification is created using the PlayerNotificationManager and MediaDescriptionAdapter from ExoPlayer.
On Android 11 on a Pixel 5 (but not a Pixel 3 XL) or any Samsung device I see two notifications: one that I see on all other OS versions, and one that appears in the settings tray on a Pixel, or the Media section (and lock screen) on Samsung devices.
At some point, I would like to support that notification properly, but for now, having two notifications is a bug, and it seems like the easiest fix should be to disable the new notification.
The linked documentation says
To be discoverable your app must provide a MediaBrowserService, typically using the MediaBrowserServiceCompat library from Android Jetpack.
My app has an androidx.media2.MediaSessionService, which hides the MediaBrowserService. I have tried returning null from the onGetSession() method, but the notification still appears. It seems like I need a way to do the equivalent of returning null from onGetRoot().
Is there anything I can do to opt out of this notification without rewriting all of my MediaSession/MediaSessionService code to use the older compat equivalents?

When is sessionReachabilityDidChange(_:) called on a watch WCSessionDelegate?

Apple's documentation says this in the discussion section of the method description:
This method is called to let the
current process know that its counterpart session’s reachability
changed.
The description of the isReachable property says this: WatchKit
extension. The iOS device is within range, so communication can occur
and the WatchKit extension is running in the foreground, or is running
with a high priority in the background (for example, during a workout
session or when a complication is loading its initial timeline data).
I am assuming this would mean that if the watch moves out of or into range of the iOS device, the WatchKit extension would be launched and the WCSessionDelegate's sessionReachabilityDidChange() method would be called, and the WCSession's isReachable would be true if the iOS device just came into range and false if it just when out of range.
I have not found a way to verify this in xcode. For example I put a log message in sessionReachabilityDidChange(_:) and walked out of range, but xcode simply says the app lost connection with the iphone and can no longer debug it. Can someone verify this or point me to some documentation that better describes this?
I think you cannot verify this in Xcode.
I have an app on iOS and watchOS. To check this kind of situation, I can enable debug alerts on iOS and watchOS. When func sessionReachabilityDidChange(session: WCSession) is triggered, I display a debug alert.
Now, if I run (not under Xcode) my watch extension, and then switch off the paired iPhone, the debug alert is shown on the watch.
This shows that sessionReachabilityDidChange is actually called as expected.
Apparently, under Xcode a connected iOS device is always reachable.
EDIT:
To check the situation when the watch extension is not in foreground, I did the following:
Instead of showing a debug alert, I set now the complication to a unique value that is not possible otherwise. I launched the watch extension and put it into background by showing the watch face with the complication.
When I now switch off the iPhone, the complication is not updated.
This indicates to me that sessionReachabilityDidChange is not called in background.

How can I judge whether deep freeze is in frozen programatically?

Two problem here:
Just like the title, when Faronics' deep freeze is running at my computer, how can I find whether it is in frozen state programatically?
Deep freeze seriously influence my software update scheme, Is there any good idea to handle it?
Any answer is appreciated. thanks!
You can query windows event log for checking Deep Freeze frozen or thawed state.
When Deep Freeze is in Frozen state it will create an event log under
Event Logs > Windows > Application
Event Data : Frozen
When Deep Freeze is in Thawed state it will create an event log under
Event Logs > Windows > Application
Event Data : Thawed
I found it by searching the registry
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Faronics\Deep Freeze 6\DF Status
This will be either Frozen or Thawed as a string.
An oddity is the fact that it says Deep Freeze 6 in the registry but i have version 8 installed.
First Question:
Hold down the shift key and double-click the Deep Freeze icon. Alternatively, you can press CTRL+ALT+SHIFT+F6.
Enter your password and click OK.(ask the shop owner)
If you have not yet entered a password you should be able to click OK without entering a password.
The Boot Options dialog is displayed. That will tell you if it's active.
Second Question:
Deep Freeze is not optimized to handle updates. I've tried a few different solutions similar to Deep Freeze and found that Drive Vaccine was the most user friendly in terms of implementing updates. Something to keep in mind, as I know the handling of updates has been many people's biggest complaint about Deep Freeze.

How to open the Date/Time settings on Windows Phone 8 programmatically?

The app I'm working on relies on the correct date/time being set for synchronization purposes. Apparently you cannot programmatically set the date and time on the phone. Is there a way though to open the Date/Time settings programmatically?
You can use the Lancher class to navigate to various settings, but there's NO option to open the date time selection.
Here's the available uri schemes for settings:
Launch Airplane Mode Settings Page: ms-settings-airplanemode:
Launch Bluetooth Settings Page: ms-settings-bluetooth:
Launch Cellular Settings Page: ms-settings-cellular:
Launch Wi-Fi Settings Page: ms-settings-wifi:
Launch Location Settings Page: ms-settings-location:
Launch Account Settings Page: ms-settings-accounts:
Launch Email Account Settings Page: ms-settings-emailandaccounts:
Launch Lock Screen Settings Page: ms-settings-lock:
All available Uri Scemes
Thanks for clearing that up. I don't think you can do this the way you want to.
From this link:
At best you can get the difference between the user's clock and the clock on the system to which the program is talking. Of course the user's clock is subject to change. I don't think that people change their clock's time very frequently, but it is still something to be considered.
You can launch some settings programatically like this:
Windows.System.Launcher.LaunchUriAsync(new Uri(“ms-settings-bluetooth:”));
But date/time is not one of them. here is a link to available settings

LocationManager.NETWORK_PROVIDER is not triggering onLocationChanged in ICS

Does anybody know what happened with event-listener for location changed for WI-FI provider. I saw a lot of questions about this but no proper answer.
I'm doing everything fine and it is working for older versions of android, but now I updated my SAMSUNG GALAXY TAB 10.1 to ICS and it is not working anymore. Maybe this is a SAMSUNG (or my mobile provider) bug when they implemented their UI into ICS...
I'm registering eventlistener like this (have in mind that it works good in prevous versions of android and I also enabled all location services in settings):
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, loclistener);
//refresh time and distance are to 0 so it should trigger location change event
After this request I checked if network provider is enabled and it shows like it is.
Code:
if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
Toast.makeText(this, "NETWORK PROVIDER enabled!", Toast.LENGTH_LONG).show();
}
If someone has an idea please help me...
This is known issue:
After device reboot the network location provider works fine but after some time it stops updating.
https://code.google.com/p/android/issues/detail?id=57707
Unfortunately without solution yet.
To track how often the network provider is updating, I modified the onLocationChanged() method to the following:
public void onLocationChanged(Location location) {
dummyText.setText(location.toString() + "\n" + "Elapsed Time (ms): " + (lastTime - location.getTime()));
lastTime = location.getTime();
}
And added:
long lastTime = 0;
...as a global variable.
This will print out the time between updates in milliseconds (after the first fix - first fix will just print the negative time value from the first Location).
I ran the above code on my Samsung Galaxy S3, and the network provider updates around every 20 seconds, so the code seems fine.
I also ran this on a Samsung Dart (from T-mobile, but not activated) on WiFi, and the network provider updates around every 45 seconds.
I also ran this on a Samsung Nexus S 4G (from Sprint, but not activated) on WiFi, and the network provider at first didn't update at all. Restarting the device seemed to fix the problem, and now its updating roughly every 20 seconds.
Based on your comments and my experience, it looks like this issue varies between OEMs and even between device models of the same OEM. It might be another quirk of the lack of the strict enforcement of LocationListener behavior prior to Android Jelly Bean 4.1. Strict enforcement of LocationListener behavior only recently started in Android Jelly Bean 4.1, which is mentioned in the Android developer docs here in under the first requestLocationUpdates method signature:
http://developer.android.com/reference/android/location/LocationManager.html
Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. From Jellybean and onwards it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.
Also, from my experience, the refresh interval of the NETWORK_PROVIDER location updates on devices that do update is pretty fixed at around 20-30 seconds across many different devices. So, the minTime parameter you pass into the locationManager.requestLocationUpdates() method is likely to be ignored.
Having to reboot the device to get a network provider location is likely due to not getting a response from the Google server that provides this location info. Not sure why rebooting fixes it.
I had the same problem with the NETWORK_PROVIDER. The reason is that when you request for updates, the NETWORK_PROVIDER does not create a callback for the method onLocationChanged(). You also need to call getLastKnownLocation(NETWORK_PROVIDER) in order for it to start updating the location.
The weird thing is that for the GPS_PROVIDER this is not neccessary.
I hope this helps.
Ok. So now I got it working. It is really strange. I restarted all my devices and now it updates. I don't know what happened and I would really like to know what is the reason for this strange behavior. Thank you #barbeau for all your time and help.

Resources