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

Method GetSerializableObject

dotnet/src/webdriver/RelativeBy.cs:361–386  ·  view source on GitHub ↗
(object root)

Source from the content-addressed store, hash-verified

359 }
360
361 private static object GetSerializableObject(object root)
362 {
363 if (root == null)
364 {
365 throw new ArgumentNullException(nameof(root), "object to serialize must not be null");
366 }
367
368 if (root is By asBy)
369 {
370 Dictionary<string, object> serializedBy = new Dictionary<string, object>();
371 serializedBy[asBy.Mechanism] = asBy.Criteria;
372 return serializedBy;
373 }
374
375 if (root is IWebElement element)
376 {
377 return element;
378 }
379
380 if (root is IWrapsElement wrapper)
381 {
382 return wrapper.WrappedElement;
383 }
384
385 throw new WebDriverException("Serializable locator must be a By, an IWebElement, or a wrapped element using IWrapsElement");
386 }
387
388 private static object? GetSearchRoot(ISearchContext context)
389 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected