MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ConvertStatusToCode

Method ConvertStatusToCode

cpp/webdriver-server/response.cc:206–289  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
206int 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected