Implements support for the
WindowSize annotation.
If this rule is used in a test and the
WindowSize annotation is
not present on either the test method, or the test class, the window will be maximized by default.
Otherwise the directives present on the annotation found (with method-level annotation superseding the class-level
one) will be applied to the current driver's window in a following manner:
- if the maximize flag is set to
true, the window will be maximized
- otherwise the properties height and width will be used to set the window size. In such
case those properties must have positive integer value, or an exception will be raised
Example:
public class MyWebDriverTest
{
@Rule public WindowSizeRule windowSizeRule = //...
@Test
public void myTest()
{
// at this stage the window will be maximized
}
}
public class MyWebDriverTest
{
@Rule public WindowSizeRule windowSizeRule = //...
@Test
@WindowSize(width=1024,height=768)
public void myTest()
{
// at this stage the window will be set to 1024x768
}
}