Hi
I am getting error - InvalidOperationException: session not created: This version of ChromeDriver only supports Chrome version 123
Current browser version is 127.0.6533.89 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe (SessionNotCreated)
static async Task SingleVideo0()
{
{
using (IWebDriver driver = new ChromeDriver())
{
driver.Navigate().GoToUrl("google.com");
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var playButtons = wait.Until(_driver => _driver.FindElements(By.ClassName("video-play-button")));
foreach (var playButton in playButtons)
{
playButton.Click();
System.Threading.Thread.Sleep(2000);
}
}
}
}
Thanks
Abhishek YadavPosted Aug 4, 2024, 5:46 AM
It looks like the ChromeDriver version you're using is not compatible with your current version of Chrome. You need to update your ChromeDriver to match your Chrome browser version. Here’s how you can do it:
Download the Compatible ChromeDriver:
Update ChromeDriver in Your Project:
chromedriver.exefile in your project or system with the newly downloaded one.chromedriver.exeis in your project directory or in a location that is included in your system's PATH environment variable.Verify Compatibility:
ChromeDriverversion and theChromebrowser version are both up-to-date and compatible with each other.Here's an updated version of your method to include proper disposal of
WebDriver:By using
await Task.Delay, you ensure that the sleep operation is asynchronous and won't block the thread.