protected function validateSeleniumResponseCode($response, $polling)
{
// Selenium response status exceptions
if ($response['body'] != null) {
if (isset($response['body']["value"]["localizedMessage"])) {
$message = $response['body']["value"]["localizedMessage"];
} else {
$message = "";
}
switch (intval($response['body']["status"])) {
case 7:
if (!$polling) {
throw new SeleniumExceptions\NoSuchElement($message);
}
break;
case 8:
throw new SeleniumExceptions\NoSuchFrame($message);
break;
case 9:
throw new SeleniumExceptions\UnknownCommand($message);
break;
case 10:
throw new SeleniumExceptions\StaleElementReference($message);
break;
case 11:
throw new SeleniumExceptions\ElementNotVisible($message);
break;
case 12:
throw new SeleniumExceptions\InvalidElementState($message);
break;
case 13:
throw new SeleniumExceptions\UnknownError($message);
break;
case 15:
throw new SeleniumExceptions\ElementIsNotSelectable($message);
break;
case 17:
throw new SeleniumExceptions\JavaScriptError($message);
break;
case 19:
throw new SeleniumExceptions\XPathLookupError($message);
break;
case 21:
throw new SeleniumExceptions\Timeout($message);
break;
case 23:
throw new SeleniumExceptions\NoSuchWindow($message);
break;
case 24:
throw new SeleniumExceptions\InvalidCookieDomain($message);
break;
case 25:
throw new SeleniumExceptions\UnableToSetCookie($message);
break;
case 26:
throw new SeleniumExceptions\UnexpectedAlertOpen($message);
break;
case 27:
throw new SeleniumExceptions\NoAlertOpenError($message);
break;
case 28:
throw new SeleniumExceptions\ScriptTimeout($message);
break;
case 29:
throw new SeleniumExceptions\InvalidElementCoordinates($message);
break;
case 30:
throw new SeleniumExceptions\IMENotAvailable($message);
break;
case 31:
throw new SeleniumExceptions\IMEEngineActivationFailed($message);
break;
case 32:
throw new SeleniumExceptions\InvalidSelector($message);
break;
}
}
}