OWASP O2 Platform Blog

O2 Script to perform a google search

See also this EtherPad session (http://ietherpad.com/UYmog5ljkj) for a walk-through of how this script was developed

panel.clear();
var ie = panel.add_IE().silent(true);
ie.disableFlashing(); // use this when developing the script to make it faster
Action<string> searchGoogle =
    (searchText)=> {
                                ie.open("<a href="http://www.google.com">http://www.google.com</a>");
                                searchText = searchText.line();   
                                ie.field("Search").value(searchText).flash();
                                ie.button("Google Search").Click();
                        };

Action<string> clickOnLink =
    (linkToClick)=> {
                                if (ie.hasLink(linkToClick))
                                    ie.link(linkToClick).flash().click();
                                else
                                    "Error: could not find link: {0}".error(linkToClick);
                           };
                          
searchGoogle("OWASP Summit");
clickOnLink("Summit 2011 - OWASP");

return "all done";

//O2File:WatiN_IE_ExtensionMethods.cs
//using O2.XRules.Database.Utils.O2
//O2Ref:WatiN.Core.1x.dll

December 4, 2010 - Posted by | IE Automation, WatiN

1 Comment »


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: