Hi
I have below code . Only first Video runs then Youtube suggested Video Starts. I want that all videos in array should get displayed.
foreach (var video in videos)
{
_driver.Navigate().GoToUrl(video);
var timeElement = _driver.FindElement(By.XPath(XPATH_TIME));
string timeValue = timeElement.GetAttribute("innerText");
// Parse the timeValue to TimeSpan
if (TimeSpan.TryParse(timeValue, out TimeSpan videoDuration))
{
// Delay by the duration of the video
await Task.Delay(videoDuration);
}
else
{
// Handle parsing error, maybe log it or use a default delay
Console.WriteLine("Failed to parse video duration: " + timeValue);
await Task.Delay(TimeSpan.FromMinutes(1)); // Default delay
}
}
Thanks