/// <summary> /// Check to see if an element is present on the screen /// </summary> /// <param name="fieldID"></param> /// <returns></returns> public bool IsElementPresent(string fieldID) { counter++; try { selenium.IsElementPresent(fieldID); test.passedcheck++; return(true); } catch// (Exception) { ErrorReport(fieldID, CheckType.Element); test.failedcheck++; return(false); } }
/// <summary> /// Checks if an element is present. This will not throw an error message or up the pass/fail cout /// </summary> /// <param name="elementname">The element to check</param> /// <returns>Returns true if the element can be highlighted</returns> public static bool ElementPresent(string elementname, WebDriverBackedSelenium selenium) { try { selenium.IsElementPresent(elementname); return(true); } catch// (Exception) { return(false); } }
} /** * Browser to my account page. **/ public void clickOnMyAccountLink_US_UK() { if (driver.IsElementPresent("link=Sign Out")) { driver.Click("link=Sign Out"); } quality.Highlight("link=Sign In"); driver.Click("link=Sign In"); //accountLink_US_UK = driver.UnderlyingWebDriver.FindElement(By.LinkText("Sign In")); //accountLink_US_UK.Click(); /* * if (browser.Equals("internetexplorer")) * { * driver.Open("javascript:document.getElementById('overridelink').click()"); * } */ }