Skip to content

constantly getting a no target with given id found #38

@choval

Description

@choval

This only happens when using the userData, I need to keep the environment instead of having an entire fresh instance created on every load.

[2018-09-29 00:03:49] DEBUG socket(1): ← receiving data:{"error":{"code":-32602,"message":"No target with given id found"},"id":22}

Which eventually breaks the Session constructor because the sessionId is not returned.

PHP Fatal error:  Uncaught TypeError: Argument 2 passed to HeadlessChromium\Communication\Session::__construct() must be of the type string, null given, called in .../vendor/chrome-php/chrome/src/Communication/Connection.php on line 240 and defined in .../vendor/chrome-php/chrome/src/Communication/Session.php:42

Current workaround:

src/Communication/Connection.php
commented out the return type of createSession so I can:

$sessionId = $response['result']['sessionId'] ?? false;
if(!$sessionId)
  return;

src/Browser.php
Not creating a target if no session is returned

if(!$session)
  return;

Not sure if it's the best approach as I just started to fiddle around with this library...
I will update once I track everything down.

Great work by the way!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions