[Ranorex 5.3.2, Windows 7, Chrome 43.0.2357.81 m]
I want to re-size the Chrome browser window, to something like 640 x 960, before running a series of Test Cases. The options I have considered required the use of a third party website, Chrome extension or Google Dev Tools.
Is there a way to create a recorded module, that will re-size the Chrome browser window to 640 x 960, without the use of extensions or third party applications?
If it's not possible with a recorded module, can you please give me an indication as to how to do it with a code module?
If this is not possible for Chrome, perhaps you could please point me in the direction of how to do it for Firefox or IE.
Many thanks!
How to record a module to re-size Chrome browser window?
Re: How to record a module to re-size Chrome browser window?
Hi,
Probably the easiest way (not involving 3rd party plugin or html page) is this code:
Where the DOMName is a name of browser's DOM element stored in repository. Hope this helps?
PS:
Check also this post:
http://www.ranorex.com/blog/resize-window
Probably the easiest way (not involving 3rd party plugin or html page) is this code:
Code: Select all
repo.DOMName.Self.Resize(640,480);
PS:
Check also this post:
http://www.ranorex.com/blog/resize-window
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 339
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: How to record a module to re-size Chrome browser window?
Thanks very much odklizec! I have limited knowledge of C#, your code line is giving me the error below, which I don't understand:
Thanks again!
The code module using statements look like:'Ranorex.WebDocument' does not contain a definition for 'Resize' and no extension method 'Resize' accepting a first argument of type 'Ranorex.WebDocument' could be found (are you missing a using directive or an assembly reference?) (CS1061) - C:\0_Fergal\Ranorex\RanorexStudio Projects\[REMOVED]\Recordings\Common\Resize_Chrome_Browser_to_360_x_640.UserCode.cs:37,44
Do I need to add something else there?using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;
Thanks again!
Re: How to record a module to re-size Chrome browser window?
I'm afraid, I don't have a clue what could be wrong here? Could you please post the exact code you are using (screenshot of the UserCode.cs) and screenshot of repository containing the DOM element?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: How to record a module to re-size Chrome browser window?
OK, The problem is most probably in the xpath of your DOM. The "Resize" method is not available to all elements! So you need to be careful about the xpath behind the element you want to resize!
Try to use the xpath ending with "form" element (like /form[@title~'Google Chrome']). To verify if Resize method is available to your repo element, try to drag&drop the element to recording and in the appeared menu expand InvokeAction. If you don't see "Resize" method in the list of available actions, you need to use different path.
Another way of checking the method availability for a given element is using Rx intellisense. Once you start typing your code in source editor, Ranorex should offer you a list of available methods, variables, etc. (after each entered "."). Hope this helps?
Try to use the xpath ending with "form" element (like /form[@title~'Google Chrome']). To verify if Resize method is available to your repo element, try to drag&drop the element to recording and in the appeared menu expand InvokeAction. If you don't see "Resize" method in the list of available actions, you need to use different path.
Another way of checking the method availability for a given element is using Rx intellisense. Once you start typing your code in source editor, Ranorex should offer you a list of available methods, variables, etc. (after each entered "."). Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 339
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: How to record a module to re-size Chrome browser window?
Thanks a million odklizec, I have been working through it and that is exactly what the issue is - the Resize method is not available on my dom repository element. The XPath for the dom element I am using is simply:
dom[]
What should the XPath look like when trying to resize the Google Chrome browser window?
Thanks again!
dom[]
What should the XPath look like when trying to resize the Google Chrome browser window?
Thanks again!
Re: How to record a module to re-size Chrome browser window?
Try this path...
or even simpler, this...

Code: Select all
/form[@title~'Google Chrome']
Code: Select all
/form

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 339
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: How to record a module to re-size Chrome browser window?
Thanks odklizec, using "dom" where I should have been using "form" was the problem. It's working now and I have it in a recording module, using the Invoke > Resize option you have shown above.