cancel
Showing results for 
Search instead for 
Did you mean: 

Change browser size basing on a component size

SOLVED
Contributor

Change browser size basing on a component size

Hi all,

 

I would like to change the browser size by specifying a specific dimension for a component within the Page (and automatically adapt the browser size to display the component in the specified resolution), instead that specify the width or height of the entire browser window (with the "Position" method).

 

For example: my page displays a component, and I want to force to display this component with a resolution of 920*680. It is not relevant the browser dimensions, but the thing that is important is to have the component displayed with the required dimension.

The final scope will be to do an image comparison with a benchmark image saved with this resolution.

 

There is a way to do this?

 

Thanks!

Simona

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Change browser size basing on a component size

Hi Simona,

 

I think that how this component scales according to the size of browser's viewport is its internal functionality.

Thus I see two possible options:

a) Talk to your developers and create a table or a formula expression that will match component's size with the size of viewport. Then set viewport to the required size and you should be all set. (If component's size appears to be incorrect this may mean either an error in your table/formula or an issue in component's scaling algorithm);

b) Set some initial size for viewport and get the resulting size of component. Incrementally decrease or increase the size of viewport (or the entire browser's window, this is irrelevant in your case) in a loop until the component becomes of the size that you need.

 

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
================================

View solution in original post

4 REPLIES 4
Community Hero

Re: Change browser size basing on a component size

Here's an old example that may still work, or at least give you a place to start

https://support.smartbear.com/viewarticle/8962/

 

And here's info about the API to go along with it

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/using-external-functions/calli...

Contributor

Re: Change browser size basing on a component size

Hi @Marsha_R ,

 

thank you for the proposal! I'm trying to investigate on Win32Api methods but I'm not finding something that could modify the browser size by specifying a web component dimension.

 

I'm interested to set a specific dimension on a displayed web component (otherwise the UI code automatically zoom and readapt the web component size basing on the browser resolution, and I cannot do the image comparison with some benchmark images that I've saved with a specific resolution), so I don't know the related browser size to be set and I would like to set the browser size by specifying the component dimension.

 

Do you know if there could be some methods suitable for this scope?

 

Thanks!

Simona

Community Hero

Re: Change browser size basing on a component size

Are you able to display this web component in a different resolution than the browser if you do it manually?  How do you accomplish that?

Community Hero

Re: Change browser size basing on a component size

Hi Simona,

 

I think that how this component scales according to the size of browser's viewport is its internal functionality.

Thus I see two possible options:

a) Talk to your developers and create a table or a formula expression that will match component's size with the size of viewport. Then set viewport to the required size and you should be all set. (If component's size appears to be incorrect this may mean either an error in your table/formula or an issue in component's scaling algorithm);

b) Set some initial size for viewport and get the resulting size of component. Incrementally decrease or increase the size of viewport (or the entire browser's window, this is irrelevant in your case) in a loop until the component becomes of the size that you need.

 

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
================================

View solution in original post

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