static void main() { string url = "http://testing.todorvachev.com/selectors/id"; string id = "testImage"; IWebdrive driver = new chromeDriver(); driver.navigate().GoToUrl(url); IWebeElement element = driver.FindElemet(By.Id(id)); if (elment.Displayed) { GreenMessage("Found the element"); } else { ReadMessage("Not Found"); } driver.Quit(); }
static void FoundClass() { string url = "http://testing.todorvachev.com/selectors/id"; string ClassName = "testClass"; IWebdrive driver = new chromeDriver(); driver.navigate().GoToUrl(url); IWebeElement element = driver.FindElemet(By.ClassName(ClassName)); if (elment.Displayed) { GreenMessage("Found the element"); } else { ReadMessage("Not Found"); } Console.WriteLine(elemet.Text); driver.Quit(); }