| 161 | } |
| 162 | |
| 163 | std::string Response::ConvertErrorCode(const int error_code) { |
| 164 | if (error_code == WD_SUCCESS) { |
| 165 | return ""; |
| 166 | } else if (error_code == ENOSUCHFRAME) { |
| 167 | return ERROR_NO_SUCH_FRAME; |
| 168 | } else if (error_code == ENOSUCHWINDOW) { |
| 169 | return ERROR_NO_SUCH_WINDOW; |
| 170 | } else if (error_code == EOBSOLETEELEMENT) { |
| 171 | return ERROR_STALE_ELEMENT_REFERENCE; |
| 172 | } else if (error_code == EINVALIDSELECTOR) { |
| 173 | return ERROR_INVALID_SELECTOR; |
| 174 | } else if (error_code == ENOSUCHALERT) { |
| 175 | return ERROR_NO_SUCH_ALERT; |
| 176 | } else if (error_code == EUNEXPECTEDALERTOPEN) { |
| 177 | return ERROR_UNEXPECTED_ALERT_OPEN; |
| 178 | } else if (error_code == ENOSUCHCOOKIE) { |
| 179 | return ERROR_NO_SUCH_COOKIE; |
| 180 | } else if (error_code == EELEMENTNOTENABLED) { |
| 181 | return ERROR_INVALID_ELEMENT_STATE; |
| 182 | } else if (error_code == EELEMENTNOTDISPLAYED) { |
| 183 | return ERROR_ELEMENT_NOT_INTERACTABLE; |
| 184 | } else if (error_code == EUNEXPECTEDJSERROR) { |
| 185 | return ERROR_JAVASCRIPT_ERROR; |
| 186 | } else if (error_code == EINVALIDCOOKIEDOMAIN) { |
| 187 | return ERROR_INVALID_COOKIE_DOMAIN; |
| 188 | } else if (error_code == ESCRIPTTIMEOUT) { |
| 189 | return ERROR_SCRIPT_TIMEOUT; |
| 190 | } else if (error_code == EMOVETARGETOUTOFBOUNDS) { |
| 191 | return ERROR_MOVE_TARGET_OUT_OF_BOUNDS; |
| 192 | } else if (error_code == EINVALIDARGUMENT) { |
| 193 | return ERROR_INVALID_ARGUMENT; |
| 194 | } else if (error_code == ENOSUCHELEMENT) { |
| 195 | return ERROR_NO_SUCH_ELEMENT; |
| 196 | } else if (error_code == EUNSUPPORTEDOPERATION) { |
| 197 | return ERROR_UNSUPPORTED_OPERATION; |
| 198 | } |
| 199 | |
| 200 | return ""; |
| 201 | } |
| 202 | |
| 203 | // TODO: This method will be rendered unnecessary once all implementations |
| 204 | // move to string status codes instead of integer status codes. This mapping |
nothing calls this directly
no outgoing calls
no test coverage detected