I want to add different behavior to a form based on whether they are on a device (mobile / tablet) vs a desktop computer / laptop. How do I find this information out?
There are current no Maestro methods to find this out. However you can do this yourself.
If you only are looking for screen size then I recommend using the window.matchMedia("only screen and (max-width: 760px)") method as it does not look at the userAgent.
Other methods can be found here:
Also, you can find out the current browser by using Resource.browserType.
In Maestro 5.1 you will be able to find out if the device is iOS or Android by using Resource.deviceType
Also found this: https://modernizr.com/
The link is interesting, do you know how you can use it on Maestro?
Using Modernizr in Maestro is pretty easy:
However, debate is strong as to how to best determine if a user is on a mobile device or not. For me, I think I'll take a very simple approach and go with something like this:
var isMobile = navigator.userAgent.match(
I've added an article to the Knowledge Base on this topic: