Skip to content

Instantly share code, notes, and snippets.

@dcrosby42
Created November 11, 2010 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcrosby42/672034 to your computer and use it in GitHub Desktop.
Save dcrosby42/672034 to your computer and use it in GitHub Desktop.
Extension method for WatiN.Core.Browser, utilizes in-page JS function WatinSearchHelper.getElementId()
using WatiN.Core;
namespace WatinSearchHelper
{
public static class BrowserExtensions
{
public static Element FindViaJQuery(this Browser browser, string cssSelector)
{
var elementId = browser.Eval(string.Format("WatinSearchHelper.getElementId(\"{0}\")", cssSelector));
return browser.Element(Find.ById(elementId));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment