All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v90.runtime.model.InternalPropertyDescriptor Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.0.0-beta-4
Show newest version
package org.openqa.selenium.devtools.v90.runtime.model;

import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;

/**
 * Object internal property descriptor. This property isn't normally visible in JavaScript code.
 */
public class InternalPropertyDescriptor {

    private final java.lang.String name;

    private final java.util.Optional value;

    public InternalPropertyDescriptor(java.lang.String name, java.util.Optional value) {
        this.name = java.util.Objects.requireNonNull(name, "name is required");
        this.value = value;
    }

    /**
     * Conventional property name.
     */
    public java.lang.String getName() {
        return name;
    }

    /**
     * The value associated with the property.
     */
    public java.util.Optional getValue() {
        return value;
    }

    private static InternalPropertyDescriptor fromJson(JsonInput input) {
        java.lang.String name = null;
        java.util.Optional value = java.util.Optional.empty();
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "name":
                    name = input.nextString();
                    break;
                case "value":
                    value = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v90.runtime.model.RemoteObject.class));
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new InternalPropertyDescriptor(name, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy