Open jakub-g opened 10 years ago
For info, solution 1 is already implemented: the computed viewport offset is not relative to the screen, but to the browser window, so if the browser window is simply moved in the screen, the positions should still be computed correctly. The only remaining problem is when passing from the maximized state to a non-maximized state, which changes the position of the viewport inside the browser window (probably due to the border which is different). @jakub-g Your suggestion (solution 2) to solve this issue is interesting. Another (simpler) possibility would be to have a command line option allowing to choose whether the browser should be maximized or not.
But I think the implementation of 1) is fragile since e.g. Chrome displays a yellow warning bar at the top of the browser, if I close this bar, then the viewport position relative to browser window changes, and robot will malfunction.
I think the suggestion 2) is better than command line flag to maximize the viewport (but this flag perhaps also could be added): by manually starting the calibration, the user has the greatest flexibility to do anything he needs with the browser window.
The other issue is e.g. with IE displaying a bar at the bottom of the browser asking "do you want IE to be a default browser" etc. which when displayed, makes calibration fail.
I think the feature could sit behind a command line flag (--auto-calibration
) and that flag probably should default to false
, in many case it's useful to be able to do something before calibration, and having to pass the flag which is almost always wanted is boring.
Having said that, it was a good try in the first place to automate the calibration, but we didn't know the issues that arise when the thing is automated; right now it seems it's better to avoid automation since it can lead to problems, and just one click needed from the user is not a big issue IMO.
@jakub-g You can have a look to the new robot-server which does the calibration just before each test which needs it (during the call to getOffset).
Currently the robot starts the requested browser, maximizes it, and calibrates itself by measuring the viewport offsets of the browser wrt the OS screen.
This is however very suboptimal in certain cases. For instance, I may want to start dev tools and don't want the browser to be full screen for that reason. Also, I may want to resize a virtual machine's window.
A solution could be 1) a mechanism for tracking the movements of the browser window, 2) calibration should not be automatic but manual (perhaps behind a command line flag): SJR starts the browser, the user positions it how it fits him, presses the button in the page to start the calibration.
Solution 2 seems probably easier to implement and more robust.