cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

SOLVED
Highlighted
Contributor

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

Gang,

 

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.

 

Rich

 

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

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.

Highlighted
Community Hero

Re: Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

Hi,

 

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.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Contributor

Re: Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

I would suggest you to use VScroll  property and add logic something like this.

 

scrollprop=Object.Vscroll.Max

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.

 

-Ashwin

Please give a Kudo and accept it as a solution if this works.

Highlighted
Contributor

Re: Keyword Tests - Are there recommended best practices to make Keyword tests Resolution agnostic?

Gang,

 

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.

 

Rich

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors