3

I am trying to resize the width/height of my browser window using Selenium IDE. I am aware that there is the function:

window.resizeTo(480, 725)

but getting this executed within Selenium IDE is causing me some grief. Would I need to write a custom function?

halfer
  • 19,824
  • 17
  • 99
  • 186
Richlewis
  • 15,070
  • 37
  • 122
  • 283

4 Answers4

2
WebDriver driver = ((WebDriverBackedSelenium) selenium).getWrappedDriver();
driver.manage().window().setPosition(new Point(0, 0));
driver.manage().window().setSize(new Dimension(1920, 1080));

check this question

Community
  • 1
  • 1
Vasiliy vvscode Vanchuk
  • 7,007
  • 2
  • 21
  • 44
1

The only way I found to resize window in selenium IDE is set this command into your script(s):

<tr>
    <td>runScript</td>
    <td>javascript{window.opener.resizeTo(1920,1080);}</td>
    <td></td>
</tr>

i.e.

Command: runScript
Target: javascript{window.opener.resizeTo(1920,1080);}
Value: <empty>

About 'window.opener' property: http://www.w3schools.com/jsref/prop_win_opener.asp

0

This is the best way I found to resize a window in Selenium IDE is to open the page in a new window before attempting to resize it.

<td>openWindow</td>
<td>http://'website or page to be opened'</td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>title='title of website/page'</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>window.resizeTo(1080,800);</td>
<td></td>

When not opening the page in a new window, Selenium would see/execute the resize command but it would ignore it.

LRM
  • 9
  • 1
0

Above works but it resizes the selenium IDE window. If you want to resize the actual firefox window, try this javascript command.

javascript{window.opener.resizeTo(x,y)}

Major
  • 455
  • 1
  • 5
  • 15