ClickAsync Timeout
Closed this issue · 12 comments
That's odd. That's the browser not responding. If you run that in headful mode, do you see the browser getting stuck? high CPU usage?
in headful mode runs without problems
It looks like an error on a Console event listener you have?
I'm using always the same input and yes I have a Page_Console event handler but why sometimes runs ok and sometimes not? Even with the same input?
Do you have a dictionary where you are collecting info? Maybe a race condition? Console events don't come always at the same time.
Can you also check if, by removing the event, the click stops getting stuck? Maybe is the listener that's breaking the flow.
Oh yes I have list and dict
.. how can avoid events not in same time?
void Page_Console(object? sender, ConsoleEventArgs e)
{
if (e.Message.Type == ConsoleType.Log)
{
if (e.Message.Text.StartsWith("scene._scene.traverse.end"))
{
structMode = false;
return;
}
if (structMode)
{
if (rootNode==null)
{
rootNode= new NodeObj();
rootNode = Newtonsoft.Json.JsonConvert.DeserializeObject<NodeObj>(e.Message.Text);
lastNode= rootNode;
} else
{
NodeObj thisNode = Newtonsoft.Json.JsonConvert.DeserializeObject<NodeObj>(e.Message.Text);
NodeObj pNode = NodeList[thisNode.ParentId];
pNode.Items.Add(thisNode);
lastNode = thisNode;
}
if (MeshList.ContainsKey(lastNode.Id))
{
lastNode.Mesh= MeshList[lastNode.Id];
}
JSObjectIndex = JSObjectIndex + 1;
Console.WriteLine("Traversing scene " + JSObjectIndex.ToString() + "/" + JSObjectCount.ToString());
PushNode(lastNode);
return;
}
if (e.Message.Text.StartsWith("Processing file") && e.Message.Text.Contains("finished"))
{
loaded3D = true;
return;
}
if (e.Message.Text.StartsWith("scene._scene.traverse.start"))
{
structMode = true;
JSObjectCount = System.Convert.ToInt64( e.Message.Text.Replace("scene._scene.traverse.start:", ""));
return;
}
if (e.Message.Text.StartsWith("{\"AAXX\":\"C@MER@\""))
{
CameraObj deserializedCam = Newtonsoft.Json.JsonConvert.DeserializeObject<CameraObj>(e.Message.Text);
CameraList.Add(deserializedCam);
Console.WriteLine("Lettura Camera " + deserializedCam.Name);
}
if (e.Message.Text.StartsWith("{\"AAXX\":\"ME$H\""))
{
MeshObj deserializedProduct = Newtonsoft.Json.JsonConvert.DeserializeObject<MeshObj>(e.Message.Text);
MeshList.Add(deserializedProduct.Id,deserializedProduct);
Console.WriteLine("Lettura Mesh " + deserializedProduct.PROG);
}
}
}
.. how can avoid events not in same time?
You can't trust the order in which the browser sends messages.
You can increase it by setting the ProtocolTimeout