本文整理匯總了C#中WatiN.Core.IE.GoTo方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.GoTo方法的具體用法?C# IE.GoTo怎麽用?C# IE.GoTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.GoTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoginUser
/// <summary>
/// Logins the user.
/// </summary>
/// <param name="browser">The <paramref name="browser"/> instance.</param>
/// <param name="userName">Name of the user.</param>
/// <param name="userPassword">The user password.</param>
/// <returns>If User login was successfully or not</returns>
public static bool LoginUser(IE browser, string userName, string userPassword)
{
// Login User
browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));
// Check If User is already Logged In
if (browser.Link(Find.ById(new Regex("_LogOutButton"))).Exists)
{
browser.Link(Find.ById("forum_ctl01_LogOutButton")).Click();
browser.Button(Find.ById("forum_ctl02_OkButton")).Click();
}
browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));
browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
browser.TextField(Find.ById(new Regex("Login1_UserName"))).TypeText(userName);
browser.TextField(Find.ById(new Regex("Login1_Password"))).TypeText(userPassword);
browser.Button(Find.ById(new Regex("LoginButton"))).ClickNoWait();
browser.GoTo(TestConfig.TestForumUrl);
return browser.Link(Find.ById(new Regex("LogOutButton"))).Exists;
}
示例2: SetUp
public void SetUp()
{
Settings.WaitForCompleteTimeOut = 10;
Settings.WaitUntilExistsTimeOut = 10;
ie = new IE();
ie.GoTo(url + "ProspectorPlus/VendorLogin.aspx");
ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
}
示例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: MyTestInitialize
public void MyTestInitialize()
{
IISManager.KillW3WP();
DatabaseManager.DropDatabase(TestEnvironment.DatabaseName);
DatabaseManager.CopyAndAttachDatabase(TestContext, TestEnvironment.DatabaseName);
// Open a new Internet Explorer window and navigate to the website
ie = new IE();
ie.GoTo(TestEnvironment.PortalUrl);
Login(TestUsers.Admin.UserName, TestUsers.Admin.Password, TestUsers.Admin.DisplayName);
}
示例5: Authorize
public Browser Authorize(string login, string password)
{
Browser browser = new IE("https://www.codeplex.com/site/login");
browser.GoTo("https://www.codeplex.com/site/login");
browser.Link("CodePlexLogin").Click();
browser.TextField("UserName").TypeText(login);
browser.TextField("Password").TypeText(password);
browser.Button("loginButton").Click();
return browser;
}
示例6: OpenIEInstance
/// <summary>
/// Opens a new IE instance with the given settings in front of other windows that are currently open.
/// </summary>
/// <param name="targetURL">The URL that the IE instance should browse to.</param>
/// <param name="silentMode">If true the test will be run without displaying any IE instance or steps.</param>
/// <param name="timeOut">The default time out to use when calling IE.AttachToIE(findby).</param>
/// <param name="autoCloseIE">If true when a reference to the IE instance is destroyed the actual window will close.</param>
/// <param name="movePointer">It true the mouse pointer will move to the top left corner of the screen when a new IE instance is created.</param>
/// <returns>The new IE instance.</returns>
public static IE OpenIEInstance(string targetURL, bool silentMode, int timeOut, bool autoCloseIE, bool movePointer)
{
Settings.MakeNewIeInstanceVisible = !silentMode;
Settings.WaitForCompleteTimeOut = timeOut;
Settings.WaitUntilExistsTimeOut = timeOut;
Settings.AttachToBrowserTimeOut = timeOut;
Settings.AutoMoveMousePointerToTopLeft = movePointer;
IE ieInstance = new IE { AutoClose = autoCloseIE };
if(!silentMode) ieInstance.ShowWindow(NativeMethods.WindowShowStyle.ShowMaximized);
ieInstance.BringToFront();
ieInstance.GoTo(targetURL);
return ieInstance;
}
示例7: Login
public bool Login(string username, string password)
{
ie = new IE();
ie.GoTo("http://www.cruisecontrolnet.org/login");
if (!AtChiliCCNet()) return false;
ie.TextField(WatiN.Core.Find.ByName("username")).SetAttributeValue("value", username);
ie.TextField(WatiN.Core.Find.ByName("password")).SetAttributeValue("value", password);
ie.Button(WatiN.Core.Find.ByName("login")).Click();
if (ie.Elements.Exists("password")) return false; // still on logon page, so login failed
return true;
}
示例8: Login
private void Login(ref IE ie)
{
Utilities.NavigateToHomePage(ref ie);
if (ie.Url.Contains("Login"))
{
ie.GoTo(Utilities.GetUrl("Index.aspx"));
string UserName = ConfigurationReader.getWebUserName();
string Password = ConfigurationReader.getWebPassword();
ie.TextField(Find.ById("txtUsername")).TypeText(UserName);
ie.TextField(Find.ById("txtPassword")).TypeText(Password);
ie.Image(Find.ById("IbLogin")).ClickNoWait();
}
}
示例9: Adding_Items_ToCart
public void Adding_Items_ToCart()
{
using (var browser = new IE())
{
browser.GoTo("http://localhost:1100/");
browser.BringToFront();
browser.Link(Find.ByText("Pop")).Click();
browser.Link(Find.ByText("Frank")).Click();
browser.Link(Find.ByText("Add to cart")).Click();
Assert.IsTrue(browser.ContainsText("8.99"));
}
}
示例10: WatinOverview
public void WatinOverview()
{
using (var ie = new IE())
{
ie.BringToFrontForDemo();
ie.AutoClose = false;
// Navigate
ie.GoTo("http://localhost:62988/Register.aspx");
// Finding a HTML element by id
var passwordTextBox = ie.TextField(Find.ById("Password"));
// Typing text
passwordTextBox.TypeText("Hello World");
// Clicking a button
ie.Button(Find.ById("DoRegister")).Click();
}
}
示例11: Demonstrate_speed
public void Demonstrate_speed()
{
new DatabaseTester().Clean();
var url = "http://localhost:1234/";
using (var ie = new IE(url))
{
for (int i = 0; i < 50; i++)
{
ie.GoTo("http://localhost:1234/");
ie.TextField("PathAndQuerystring").Value = "/MyUrl";
ie.TextField("LoginName").Value = "SomeComputer\\ThisUser";
ie.Button("submit").Click();
ie.ContainsText("/MyUrl");
ie.ContainsText("SomeComputer\\ThisUser").ShouldBeTrue();
}
}
}
示例12: DeletePostByTitle
public bool DeletePostByTitle(string title, IE ie)
{
ie.GoTo(Url);
ie.WaitForComplete();
var tblPosts = ie.Table("Posts");
if (tblPosts != null)
{
foreach (var row in tblPosts.TableRows)
{
if (!string.IsNullOrEmpty(row.Id) && row.InnerHtml.Contains(title))
{
ie.Link("a-" + row.Id).Click();
return true;
}
}
}
return false;
}
示例13: RemoveItemsFromCart
public void RemoveItemsFromCart()
{
using (var browser = new IE())
{
browser.GoTo("http://localhost:1100/");
browser.BringToFront();
browser.Link(Find.ByText("Pop")).Click();
browser.Link(Find.ByText("Frank")).Click();
browser.Link(Find.ByText("Add to cart")).Click();
browser.Link(Find.BySelector("a.RemoveLink")).Click();
Assert.IsTrue(browser.ContainsText("0"));
}
}
示例14: Register
public void Register()
{
try
{
Ie = new IE("about:blank");
Ie.GoTo("http://localhost/GuestBook/GuestBook.aspx");
Ie.TextField(Find.ByName("name")).TypeText("Jay");
Ie.TextField(Find.ByName("comments")).TypeText("Hello");
Ie.Button(Find.ByName("save")).Click();
Assert.AreEqual("Jay", Ie.TableCell(Find.By("innerText", "Jay")).Text, @"innerText does not match");
Assert.AreEqual("Hello", Ie.TableCell(Find.By("innerText", "Hello")).Text, @"innerText does not match");
}
finally
{
if (Ie != null)
{
InternetExplorer internetExplorer = (InternetExplorer)Ie.InternetExplorer;
internetExplorer.Quit();
}
}
}
示例15: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
try
{
IE ie = new IE();
ie.GoTo("www.terra.com.br");
ie.WaitForComplete();
ie.TextField("autocomplete").Value = "esporte";
ie.TextField("autocomplete").Focus();
SendKeys.SendWait("{ENTER}");
//ie.TextField("autocomplete").KeyPress((char)Keys.Enter);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}