本文整理匯總了C#中WatiN.Core.IE.Refresh方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.Refresh方法的具體用法?C# IE.Refresh怎麽用?C# IE.Refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.Refresh方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetUp
public void SetUp()
{
ie = new IE();
ie.Refresh();
ie.ClearCache();
Settings.WaitForCompleteTimeOut = 240;
// to hide IE window
// ie.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);
}
示例2: RunPageTest
private static void RunPageTest(TestSettings settings)
{
string url;
using (var browser = new IE(ConfigurationManager.AppSettings["WebpageTestUrl"]))
{
browser.TextField(Find.ById("url")).Value = settings.Url;
if (!string.IsNullOrEmpty(settings.TestLocation))
browser.SelectList(Find.ById("location")).SelectByValue(settings.TestLocation);
if (!string.IsNullOrEmpty(settings.Browser))
browser.SelectList(Find.ById("browser")).SelectByValue(settings.Browser);
browser.Link(Find.ById("advanced_settings")).ClickNoWait();
if (!string.IsNullOrEmpty(settings.Speed))
browser.SelectList(Find.ById("connection")).SelectByValue(settings.Speed);
if (settings.IsPrivate)
browser.CheckBox(Find.ById("keep_test_private")).Change();
if (!string.IsNullOrEmpty(settings.Username))
browser.TextField(Find.ById("username")).TypeText(settings.Username);
if (!string.IsNullOrEmpty(settings.Password))
browser.TextField(Find.ById("password")).TypeText(settings.Password);
browser.Button(Find.ByName("submit")).Click();
browser.WaitUntilContainsText("First View", settings.Timeout);
if (browser.ContainsText("partially complete"))
{
Thread.Sleep(10000);
browser.Refresh();
}
browser.WaitUntilContainsText("Raw page data", settings.Timeout);
url = browser.Link(Find.ByText("Raw page data")).Url;
}
var csvRequest = (HttpWebRequest) WebRequest.Create(url);
csvRequest.Accept = "text/csv";
var data = new List<PageData>();
using (var stream = csvRequest.GetResponse().GetResponseStream())
{
if (stream != null)
{
using (var reader = new StreamReader(stream))
{
using (var context = new CsvReader(reader))
{
while (context.Read())
{
var counter = data.Count;
var item = new PageData();
item.EventName = counter == 0 ? "Empty Cache" : "Cached Run " + counter;
item.Url = context.GetField<string>(3);
item.LoadTime = TimeSpan.FromMilliseconds(context.GetField<int>(4));
item.TimeToFirstByte = TimeSpan.FromMilliseconds(context.GetField<int>(5));
item.Requests = context.GetField<int>(11);
data.Add(item);
}
}
}
}
}
var host = ConfigurationManager.AppSettings["MetricTracking:Host"];
var port = int.Parse(ConfigurationManager.AppSettings["MetricTracking:Port"]);
using (var metric = new MetricTracker(host, port))
{
foreach (var run in data)
{
Console.WriteLine(run.EventName + "\t" + run.LoadTime);
var prefix = settings.Prefix + run.EventName.Replace(" ", string.Empty) + ".";
metric.Timing(prefix + "LoadTime", run.LoadTime.TotalMilliseconds);
metric.Timing(prefix + "TimeToFirstByte", run.TimeToFirstByte.TotalMilliseconds);
metric.Value(prefix + "Requests", run.Requests);
}
}
}
示例3: RegisterStandardTestUser
/// <summary>
/// Registers the standard test user.
/// </summary>
/// <param name="browser">The <paramref name="browser"/> instance.</param>
/// <param name="userName">Name of the user.</param>
/// <param name="password">The password.</param>
/// <returns>
/// If User was Registered or not
/// </returns>
public static bool RegisterStandardTestUser(IE browser, string userName, string password)
{
browser.GoTo("{0}yaf_register.aspx".FormatWith(TestConfig.TestForumUrl));
var email = "{0}@test.com".FormatWith(userName.ToLower());
browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
// Check if Registrations are Disabled
if (browser.ContainsText("You tried to enter an area where you didn't have access"))
{
return false;
}
// Accept the Rules
if (browser.ContainsText("Forum Rules"))
{
browser.Button(Find.ById("forum_ctl04_Login1_LoginButton")).Click();
browser.Refresh();
}
if (browser.ContainsText("Security Image"))
{
return false;
}
// Fill the Register Page
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_UserName"))).TypeText(
userName);
if (browser.ContainsText("Display Name"))
{
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_DisplayName"))).TypeText(userName);
}
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Password"))).TypeText(password);
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_ConfirmPassword"))).TypeText(password);
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Email"))).TypeText(email);
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Question"))).TypeText(password);
browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Answer"))).TypeText(password);
////browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_tbCaptcha"))).TypeText(captcha);
// Create User
browser.Button(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_StepNextButton"))).Click();
if (!browser.ContainsText("Forum Preferences"))
{
return false;
}
browser.Button(Find.ById(new Regex("ProfileNextButton"))).Click();
return browser.Link(Find.ById(new Regex("_LogOutButton"))).Exists;
}
示例4: Load
public void Load(IE ie)
{
ie.GoTo(Constants.Root);
ie.Link(Find.ByClass("taggedlink")).Click();
ie.Refresh();
}