Selenium Chrome: cannot parse internal JSON template

Viewed 2972

Code:

Parallel.ForEach(Users, new ParallelOptions { MaxDegreeOfParallelism = 3 }, (user) =>
{

IWebDriver driver;
driver = new ChromeDriver();
driver.Dispose();
TryAgain:
Try
{

ChromeOptions options = new ChromeOptions();
options.AddArgument("--start-maximized");
options.AddArgument("--mute-audio");
options.AddArgument(@"--user-data-dir=C:\Users\User\AppData\Local\Google\Chrome\" + Convert.ToString(user.id));
driver = new ChromeDriver(options);
if (!STUFF) // Does stuff. If something happens bad returns false. (If it fails in Try Catch section there - it goes to a debug too)
{
goto Debug
}
driver.Dispose();
}
Catch (Exception)
{
driver.Dispose();
goto TryAgain;
}
goto End;
Debug:
driver.Dispose();
goto TryAgain;
End:;

So the idea is : Three Threads doing stuff. If anything bad happens in - Try doing it again till it finishes doing what it has to.

But at point it might start going on endless loop: Something happens when it attempts to init a chromedriver. It goes to Debug, but driver.Dispose(); does nothing and it just jumps to Try again, initializing a new driver, attempting to load the profile failing again and again til I get like 150-200 chromedrivers + chrome tabs launched and my computer BSoDs because it cannot do simple stuff.

Log:

InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:timeout (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64) InPARALLEL:unknown error: cannot parse internal JSON template: Line: 1, column: 10446, Syntax error. (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86_64)

What can CAUSE this?

(The profile is good. Just tried it now - no errors)

0 Answers
Related