Finding an element by XPath in Selenium WebDriver using C#

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace MySeleniumApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Initialize the Chrome Driver
            using (IWebDriver driver = new ChromeDriver())
            {
                // Navigate to a website
                driver.Navigate().GoToUrl("https://www.example.com");

                // Find element by its XPath
                IWebElement element = driver.FindElement(By.XPath("your_xpath_here"));

                // Perform actions on the element (e.g., click, send keys, etc.)
                string elementText = element.Text;

                // Output the text of the element
                Console.WriteLine($"Element text is: {elementText}");

                // Close the driver
                driver.Quit();
            }
        }
    }
}