public API_HacmeBank(string websitePort, WatiN_IE watinIE) 
 	{
 		Url_Website = "http://localhost:{0}/HacmeBank_v2_Website".format(websitePort);
 		if (watinIE.isNull())
 			ie = "".ie(0,450,800,700);  
 		else
 			ie = watinIE;
 	}
 public API_HacmeBank(string websitePort, WatiN_IE watinIE)
 {
     Url_Website = "http://localhost:{0}/HacmeBank_v2_Website".format(websitePort);
     if (watinIE.isNull())
     {
         ie = "".ie(0, 450, 800, 700);
     }
     else
     {
         ie = watinIE;
     }
 }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <summary>
        /// Wait for an element innerText to match the <paramref name="expectedValue"/> value
        ///
        /// Note: the comparison is not CaseSensitive and trim is applied to the search values
        ///
        /// Returns null if the element was not found or if it was found but the values didn't match
        /// </summary>
        /// <param name="watinIe"></param>
        /// <param name="elementName"></param>
        /// /// <param name="expectedValue"></param>
        /// <param name="maxWait"></param>
        /// <returns></returns>
        public static WatiN_IE wait_For_Element_InnerText(this WatiN_IE watinIe, string elementName, string expectedValue, int maxWait = 1000)
        {
            if (watinIe.isNull() || elementName.notValid())
            {
                return(watinIe);
            }
            var splitWait = maxWait / 10;

            expectedValue = expectedValue.notNull() ? expectedValue.lower().trim() : "";
            for (var i = 0; i < 10; i++)
            {
                var element = watinIe.element(elementName);
                if (element.notNull() && element.innerText().valid() && element.innerText().lower().trim() == expectedValue)
                {
                    return(watinIe);
                }
                splitWait.sleep();
            }
            "[WatiN_IE][wait_For_Url] did not found the expected '{0}' value inside the element '{1}' after {2} miliseconds. ".error(expectedValue, elementName, maxWait);
            return(null);
        }
        public static WatiN_IE show_Formated_Javascript(this WatiN_IE ie, WatiN_IE temp_ie, string codeToFormat)
        {		
            var prettifyHtml = @"prettify.htm".local();
            if (prettifyHtml.fileExists().isFalse())
                return ie;			
			
            if (ie.url().isNull() || ie.url().contains("prettify.htm").isFalse())
                ie.open(prettifyHtml);  						
            var formatedJsCode = (temp_ie.isNull()) 
                                     ? ie.HostControl.formatJsCode(codeToFormat)
                                     : temp_ie.formatJsCode(codeToFormat);			
						
            var codeDiv = ie.div("codeDiv");
            codeDiv.innerHtml("<pre id=\"code\" class=\"prettyprint\">{0}</pre>".format(formatedJsCode));			
            ie.invokeScript("prettyPrint"); 			
            return ie;
        }