public string Open_Main_Page() { setup(); webGoat.openMainPage(); var pageHtml = ie.html(); Assert.That(pageHtml.contains("WebGoat"), "Could not find the word WebGoat in the default page"); if (ie.hasButton("Start WebGoat")) { webGoat.openMainPage(); ie.button("Start WebGoat").flash().click(); Assert.That(pageHtml.contains("WebGoat"), "Could not find the word WebGoat in the default page"); } LocalCopyAvailable = true; return("ok"); }
/// <summary> /// tries to find a link or button using the provided identified (<paramref name="linkOrButtonRef"/>) and click on it /// /// Returns the original watinIe object so that multiple clicks can be chained /// /// Returns null if the link or button was not found /// </summary> /// <param name="watinIe"></param> /// <param name="linkOrButtonRef"></param> /// <returns></returns> public static WatiN_IE click(this WatiN_IE watinIe, string linkOrButtonRef) { if (watinIe.isNull() || linkOrButtonRef.notValid()) { return(watinIe); } if (watinIe.hasLink(linkOrButtonRef)) { watinIe.link(linkOrButtonRef).click(); return(watinIe); } if (watinIe.hasButton(linkOrButtonRef)) { watinIe.button(linkOrButtonRef).click(); return(watinIe); } "[WatiN_IE][click] could not find link or button with reference: {0}".error(linkOrButtonRef); return(null); }