TODO: This method will be rendered unnecessary once all implementations move to string status codes instead of integer status codes. This mapping is not entirely correct; it's merely intended as a stopgap.
| 204 | // move to string status codes instead of integer status codes. This mapping |
| 205 | // is not entirely correct; it's merely intended as a stopgap. |
| 206 | int Response::ConvertStatusToCode(const std::string& status_string) { |
| 207 | if (status_string == "success") { |
| 208 | // Special case success to return early. |
| 209 | return WD_SUCCESS; |
| 210 | } |
| 211 | |
| 212 | if (status_string == "element not selectable") { |
| 213 | return EELEMENTNOTSELECTED; |
| 214 | } |
| 215 | |
| 216 | if (status_string == "element not visible") { |
| 217 | return EELEMENTNOTDISPLAYED; |
| 218 | } |
| 219 | |
| 220 | if (status_string == "invalid cookie domain") { |
| 221 | return EINVALIDCOOKIEDOMAIN; |
| 222 | } |
| 223 | |
| 224 | if (status_string == "invalid element coordinates") { |
| 225 | return EINVALIDCOORDINATES; |
| 226 | } |
| 227 | |
| 228 | if (status_string == "invalid element state") { |
| 229 | return EELEMENTNOTENABLED; |
| 230 | } |
| 231 | |
| 232 | if (status_string == "invalid selector") { |
| 233 | return EINVALIDSELECTOR; |
| 234 | } |
| 235 | |
| 236 | if (status_string == "javascript error") { |
| 237 | return EUNEXPECTEDJSERROR; |
| 238 | } |
| 239 | |
| 240 | if (status_string == "no such alert") { |
| 241 | return ENOSUCHALERT; |
| 242 | } |
| 243 | |
| 244 | if (status_string == "no such element") { |
| 245 | return ENOSUCHELEMENT; |
| 246 | } |
| 247 | |
| 248 | if (status_string == "no such frame") { |
| 249 | return ENOSUCHFRAME; |
| 250 | } |
| 251 | |
| 252 | if (status_string == "no such window") { |
| 253 | return ENOSUCHWINDOW; |
| 254 | } |
| 255 | |
| 256 | if (status_string == "script timeout") { |
| 257 | return ESCRIPTTIMEOUT; |
| 258 | } |
| 259 | |
| 260 | if (status_string == "stale element reference") { |
| 261 | return EOBSOLETEELEMENT; |
| 262 | } |
| 263 |
nothing calls this directly
no outgoing calls
no test coverage detected