Fix more tests for phantomjs

As a bonus got rid of JavaScript call.

Refactored uls-position code to a method.

Change-Id: I1df384a02909d430c12225525d5722a0520177ee