Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A command response was not received #5

Open
hejiheji001 opened this issue Nov 19, 2018 · 1 comment
Open

A command response was not received #5

hejiheji001 opened this issue Nov 19, 2018 · 1 comment

Comments

@hejiheji001
Copy link

hejiheji001 commented Nov 19, 2018

Hi, I was using this function to execute JS in the page.

public static async Task<string> EvalJSByContextIdAsync(ChromeSession session, long executionContextId, string javaScriptStr)
{
    await s.WaitAsync();
    var evaluateResponse = await session.Runtime.Evaluate(new Runtime.EvaluateCommand
    {
        AwaitPromise = false,
        Expression = javaScriptStr,
        IncludeCommandLineAPI = true,
        ContextId = executionContextId,
        ObjectGroup = "ChromeDevProtocolWrapper"
    });
    await session.Runtime.Enable(new Runtime.EnableCommand());
    s.Release();
    return evaluateResponse.Result.Value.ToString();
}

I will get A command response was not received:Runtime.evaluate error when I call this function more than once.

var check = await CDP.EvalJSByContextIdAsync(session, executionContextId, checkScript);
while (check.Equals("False"))
{
    Thread.Sleep(5000);
    Console.WriteLine("Sleep");
    check = await CDP.EvalJSByContextIdAsync(session, executionContextId, checkScript); //Error here
}
@hejiheji001
Copy link
Author

Do you have any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant