Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?
Are there recommended best practices to make Keyword tests Resolution agnostic? Let me give you some details.
We have a few Keyword scripts that utilize screen coordinates (i.e. - using the scroll bar to drag to the bottom of the screen).
When all our team were using the same monitor brand/model, we saw no issues when running on anyone's screens (Resolution 1680 x 1050 - Recommended).
We recently added a new team member who was issued a newer monitor (Resolution 1920 x 1080 - Recommended).
When running such scripts on his monitor we are getting failures to find the scroll bar, and if he updates the script to work on his monitor we are getting "out of the window bounds" errors when running on ours.
We attempted changing his resolution settings to match ours, but now his monitor is blurry. We could change out his monitors, but we fear boxing ourselves in and creating an update/upgrade fiasco down the line as monitors are replaced over time.
So - Are there recommended best practices to make Keyword tests Resolution agnostic? We imagine this issue has come up before.
Solved! Go to Solution.
Yes - don't use coordinates. 🙂
You've seen the exact problem those cause. You'll want to find those objects by name instead of coordinates. If there are specific cases that you don't think will work that way, then start a thread and we can help you work through that too.
In addition to what was said by Marsha:
> using the scroll bar to drag to the bottom of the screen
If this is the only problem, you may consider, for example, to use <page>.Keys("[End]") to command the page to scroll to the bottom.
/Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
I would suggest you to use VScroll property and add logic something like this.
Object.Vscroll.Pos = scrollprop
By using this, what ever may be the screen resolution, the object will only be scrolled upto its max and wouldnt throw an error.
Hope this would fix your issue.
Please give a Kudo and accept it as a solution if this works.
Thank you all for your suggestions. Max over at SmartBear Support suggested the following that worked very well on all monitor types we tried it on, and i wanted to share with you:
"I would suggest and the normally best way to use this scrollbar would be to use a method native to all browsers called "ScrollIntoView". To do this from a keyword test:
1. Under the operations section on the left of the keyword test, search for "On-Screen Action".
2. Manually add this operation (by dragging and dropping the operation) into the test.
3.A dialogue should appear. In this dialogue, select the object you would like to scroll to.
4. After selecting the object, select next.
5. On this screen, a list of methods should be available. Search for "ScrollIntoView", then select it.
6. Click Finish.
When this is done, TestComplete should automatically scroll to the object."
Team - again thank you for your time and suggestions. Wish I could have seen you all in Boston in April, but maybe next year.