Ejemplo n.º 1
0
 /**
  * Construct a {@link SafariOptions} instance from given capabilites. When the {@link #CAPABILITY}
  * capability is set, all other capabilities will be ignored!
  *
  * @param capabilities Desired capabilities from which the options are derived.
  * @throws WebDriverException If an error occurred during the reconstruction of the options
  */
 public static SafariOptions fromCapabilities(Capabilities capabilities)
     throws WebDriverException {
   Object cap = capabilities.getCapability(SafariOptions.CAPABILITY);
   if (cap instanceof SafariOptions) {
     return (SafariOptions) cap;
   } else if (cap instanceof Map) {
     try {
       return SafariOptions.fromJsonMap((Map) cap);
     } catch (IOException e) {
       throw new WebDriverException(e);
     }
   } else {
     return new SafariOptions();
   }
 }