Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion java/src/org/openqa/selenium/remote/SessionId.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.openqa.selenium.remote;

import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
Expand Down Expand Up @@ -52,7 +53,7 @@ public boolean equals(@Nullable Object obj) {
return obj instanceof SessionId && opaqueKey.equals(((SessionId) obj).opaqueKey);
}

private Object toJson() {
private String toJson() {
return opaqueKey;
}

Expand All @@ -61,6 +62,13 @@ private static SessionId fromJson(Object raw) {
return new SessionId(String.valueOf(raw));
}

if (raw instanceof Map) {
Map<?, ?> map = (Map<?, ?>) raw;
if (map.get("value") instanceof String) {
return new SessionId(String.valueOf(map.get("value")));
}
}

throw new JsonException("Unable to coerce session id from " + raw);
}
}
Loading