[java] Fixing NPE in Chrome, it can return null as the value of navigator.userAgent if no page is open yet
@@ -60,7 +60,7 @@ public static boolean isFirefox(WebDriver driver) {
public static boolean isInternetExplorer(WebDriver driver) {
String userAgent = getUserAgent(driver);
- return userAgent.contains("MSIE") || userAgent.contains("Trident");
+ return userAgent != null && userAgent.contains("MSIE") || userAgent.contains("Trident");
}
public static boolean isChrome(WebDriver driver) {
