Created
May 4, 2012 03:00
-
-
Save ksummerlin/2591617 to your computer and use it in GitHub Desktop.
Example - Simple LoadableComponent in .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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