You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I am trying to implement video recording for Selenium tests (headless Chrome)
I start Chrome with Selenium and get WebSocketDebuggerUrl from the driver log.
After this, I am trying to create ChromeSession object but it fails with NullReferenceException
I read entire ReadMe - and check sample - but it still not clear for me - should I Rebuild protocol or do smth else?
`var service = ChromeDriverService.CreateDefaultService();
service.LogPath = $"c:\temp\{Guid.NewGuid()}.log";
service.EnableVerboseLogging = true;
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
chromeOptions.AddArguments("window-size=2560,1440");
chromeOptions.AddArguments("no-sandbox");
Driver = new ChromeDriver(service, chromeOptions, _timeout);
var webSocketDebuggerUrl = string.Empty;
while (string.IsNullOrEmpty(webSocketDebuggerUrl))
{
try
{
using (var fs = new FileStream(service.LogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (StreamReader reader = new StreamReader(fs))
{
while (!reader.EndOfStream)
{
//"webSocketDebuggerUrl": "ws://localhost:59941/devtools/browser/2ccd43e7-e96a-4432-9d0d-bc29e8f13c5b"
var line = reader.ReadLine();
if (line.Contains("webSocketDebuggerUrl"))
{
var split = line.Split(' ');
webSocketDebuggerUrl = split[split.Length - 1].Replace("\"", string.Empty);
}
}
}
}
}
catch
{
}
}
var chrome = Driver as ChromeDriver;
var parameters = new Dictionary<string, object>
{
{ "format", "png" },
{ "everyNthFrame", 1 }
};
chrome.ExecuteChromeCommand("Page.startScreencast", parameters);
var chromeSessionFactory = new ChromeSessionFactory();
var chromeSession = chromeSessionFactory.Create(webSocketDebuggerUrl);`
P.S.
Thx for this great repository!
The text was updated successfully, but these errors were encountered:
Hello I am trying to implement video recording for Selenium tests (headless Chrome)
I start Chrome with Selenium and get WebSocketDebuggerUrl from the driver log.
After this, I am trying to create ChromeSession object but it fails with NullReferenceException
I read entire ReadMe - and check sample - but it still not clear for me - should I Rebuild protocol or do smth else?
`var service = ChromeDriverService.CreateDefaultService();
service.LogPath = $"c:\temp\{Guid.NewGuid()}.log";
service.EnableVerboseLogging = true;
P.S.
Thx for this great repository!
The text was updated successfully, but these errors were encountered: