The first attempt when trying to get the position of an element with respect to the document has been to use the getBoundingClientRect method.
I am working in a section of the application which is going to require the user to be able to do a number of different operations. What I need to use for this are different kinds of
MouseEvent properties, however it is important understanding them to use them in the most effective way.
Continue reading Understanding MouseEvent properties clientX and pageX
If you develop for Android you might want to be able to capture your screen to show a bug or the differences between two things and ask for suggestions.
So to do so we need
adb installed and configured.
First of all make sure that adb sees your device:
Then you can launch the recording session:
adb shell screenrecord /sdcard/android-video-capture.mp4
adb shell screenrecord --help Usage: screenrecord [options]
Android screenrecord v1.2. Records the device's display to a .mp4 file. Options: --size WIDTHxHEIGHT Set the video size, e.g. "1280x720". Default is the device's main display resolution (if supported), 1280x720 if not. For best results, use a size supported by the AVC encoder. --bit-rate RATE Set the video bit rate, in bits per second. Value may be specified as bits or megabits, e.g. '4000000' is equivalent to '4M'. Default 4Mbps. --bugreport Add additional information, such as a timestamp overlay, that is helpful in videos captured to illustrate bugs. --time-limit TIME Set the maximum recording time, in seconds. Default / maximum is 180. --verbose Display interesting information on stdout. --help Show this message. Recording continues until Ctrl-C is hit or the time limit is reached.
In Chrome for Android I am working with large images. What we want it is the ability for the user to resize the image properly in a smooth way. For small images this works quite fine, however when it comes to large images, for example images captured from device’s camera, this operation is not really smooth.
To force Chrome to use the GPU, all we need is a CSS transform property applied to the image, for example:
transform: translate3d(0, 0, 0);
This will improve drastically the perceived smoothness of the image while working with it. Even if the CSS transform property it is not going to change anything on how the image is displayed or rendered, it will force the GPU to take care of the rendering, making the transition much smoother.
Working with Android Studio means that we need to use gradle projects, however it might happen that some of our old projects were made in pure Java and with Maven, this is actually quite likely.
Converting a project from one format to another is though quite easy to be done through the command line and the
built init plugin.
In particular this tool allows us to convert not just from Maven but also from grails, java and scala.
Anyway, to move from Maven to gradle we just need to:
cd project gradle init --type pom
At this point we can import the project into Android Studio quite easily.
What is a Singleton? A singleton is a class which should only be initialized once, provide a way to allow multiple instances of that class to be used, and finally to be the central point of access for that class.
Typical use cases of a singleton are classes accessing to system resources. In my scenario I want for example to create a singleton for Selendroid, since I really want to create just one instance of Selendroid to run all my tests.
Previously I used the jar libraries for the Selenium/Selendroid project to work fine, however the method is not really ideal. Project dependencies should be imported automatically with a dependency sistem of some sort. Here I am going to add Maven to the project and manage the dependenices through it. Here I am going to add selenium-java and selendroid-standalone, but this is of course valid for any other library.
Continue reading Adding Maven to a project in IntelliJ
So now that we know that Selenium is working as we expect (I am a newbie here), we can try adding Seledroid. If you haven’t used Selendroid before, I strongly recommend you to follow the initial setup guide, available here. Basically you will need to have
ANDROID_HOME variables correctly set up in your system.
Continue reading A simple test with Seledroid
Before getting into using Seledroid, it is probably a good idea to see if my old understandings of Selenium still apply. I haven’t used it in ages, so as a first step I will configure an IntelliJ project using Selenium.
Continue reading Getting ready to write our first Selenium Test in IntelliJ