Skip to content

Instantly share code, notes, and snippets.

@ksummerlin
Created May 4, 2012 03:00
Show Gist options
  • Save ksummerlin/2591617 to your computer and use it in GitHub Desktop.
Save ksummerlin/2591617 to your computer and use it in GitHub Desktop.
Example - Simple LoadableComponent in .NET
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class DefaultPageObject : LoadableComponent<DefaultPageObject>
{
readonly IWebDriver driver;
public DefaultPageObject(IWebDriver d)
{
driver = d;
PageFactory.InitElements(driver, this);
}
[FindsBy(How = How.Id, Using = "webViewLink")]
readonly IWebElement webShellLink = null;
protected override void ExecuteLoad()
{
driver.Navigate().GoToUrl("http://localhost/vdir/");
}
protected override bool EvaluateLoadedStatus()
{
if ((driver.Url.Contains("Default.aspx") == false)) {
UnableToLoadMessage = "Not on the root Default.aspx page.";
return false;
}
if ((webShellLink == null)) {
UnableToLoadMessage = "WebView link is not available.";
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment