(options ...APIRequestContextStorageStateOptions)
| 335 | } |
| 336 | |
| 337 | func (r *apiRequestContextImpl) StorageState(options ...APIRequestContextStorageStateOptions) (*StorageState, error) { |
| 338 | params := map[string]any{} |
| 339 | var path *string |
| 340 | if len(options) == 1 { |
| 341 | params["indexedDB"] = options[0].IndexedDB |
| 342 | path = options[0].Path |
| 343 | } |
| 344 | result, err := r.channel.SendReturnAsDict("storageState", params) |
| 345 | if err != nil { |
| 346 | return nil, err |
| 347 | } |
| 348 | if path != nil { |
| 349 | if err := os.MkdirAll(filepath.Dir(*path), 0o777); err != nil { |
| 350 | return nil, err |
| 351 | } |
| 352 | file, err := os.Create(*path) |
| 353 | if err != nil { |
| 354 | return nil, err |
| 355 | } |
| 356 | if err := json.NewEncoder(file).Encode(result); err != nil { |
| 357 | return nil, err |
| 358 | } |
| 359 | if err := file.Close(); err != nil { |
| 360 | return nil, err |
| 361 | } |
| 362 | } |
| 363 | var storageState StorageState |
| 364 | remapMapToStruct(result, &storageState) |
| 365 | return &storageState, nil |
| 366 | } |
| 367 | |
| 368 | func (r *apiRequestContextImpl) Tracing() Tracing { |
| 369 | return r.tracing |
nothing calls this directly
no test coverage detected