Skip to content

Commit 6894ae4

Browse files
author
Mike Reiche
committed
API improvements
1 parent 99c263c commit 6894ae4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

driver-ui-desktop/src/main/java/eu/tsystems/mms/tic/testframework/webdrivermanager/DesktopWebDriverRequest.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,23 @@ public Optional<URL> getServerUrl() {
7878
}
7979

8080
public Dimension getWindowSize() {
81+
int width = 1920;
82+
int height = 1080;
83+
8184
String windowSizeProperty = PropertyManager.getProperty(TesterraProperties.WINDOW_SIZE, PropertyManager.getProperty(TesterraProperties.DISPLAY_RESOLUTION));
82-
Pattern pattern = Pattern.compile("(\\d+)x(\\d+)");
83-
Matcher matcher = pattern.matcher(windowSizeProperty);
84-
int width;
85-
int height;
8685

87-
if (matcher.find()) {
88-
width = Integer.parseInt(matcher.group(1));
89-
height = Integer.parseInt(matcher.group(2));
90-
} else {
91-
log().error(String.format("Unable to parse property %s=%s, falling back to default", TesterraProperties.WINDOW_SIZE, windowSizeProperty));
92-
width = 1920;
93-
height = 1080;
86+
if (windowSizeProperty != null) {
87+
Pattern pattern = Pattern.compile("(\\d+)x(\\d+)");
88+
Matcher matcher = pattern.matcher(windowSizeProperty);
89+
90+
if (matcher.find()) {
91+
width = Integer.parseInt(matcher.group(1));
92+
height = Integer.parseInt(matcher.group(2));
93+
} else {
94+
log().error(String.format("Unable to parse property %s=%s, falling back to default", TesterraProperties.WINDOW_SIZE, windowSizeProperty));
95+
}
9496
}
97+
9598
return new Dimension(width, height);
9699
}
97100
}

0 commit comments

Comments
 (0)