本文整理汇总了C#中WatiN.Core.IE类的典型用法代码示例。如果您正苦于以下问题:C# IE类的具体用法?C# IE怎么用?C# IE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IE类属于WatiN.Core命名空间,在下文中一共展示了IE类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:33,代码来源:TestHelper.cs
示例2: GettingHtml
public static HtmlNode GettingHtml(IE browser)
{
var doc = new HtmlDocument(); //install parsed doc in HTML Agility Pack
doc.LoadHtml(browser.Body.OuterHtml); //place html in parser from Bank.Gov
var dataBlock = doc.DocumentNode.SelectSingleNode("//div[@class=\"content\"]");
return dataBlock;
}
开发者ID:vitaliyzamiraylo,项目名称:ex_rate,代码行数:7,代码来源:Methods.cs
示例3: FetchEvents
/// <summary>
/// Screen Scrape Events
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
static List<EventDetail> FetchEvents(string query)
{
var eventDetails = new List<EventDetail>();
using (var _browser = new IE("http://www.gettyimages.com", false))
{
_browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);
_browser.TextField(Find.ById("txtPhrase")).Clear();
_browser.TextField(Find.ById("txtPhrase")).TypeText(query);
var editorialChkfield = _browser.CheckBox(Find.ById("cbxEditorial"));
if (!editorialChkfield.Checked)
editorialChkfield.Click();
_browser.Button(Find.ById("btnSearch")).Click();
if (_browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Exists)
{
_browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Click();
_browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent")).WaitUntilExists();
var filterContentDiv = _browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent"));
foreach (var link in filterContentDiv.Links.Filter(Find.ByClass("refineItem")))
{
var splitList = link.OuterHtml.Split('\'');
if (splitList.Length > 5)
eventDetails.Add(new EventDetail() { EventId = int.Parse(splitList[1]), EventName = splitList[5].Trim() });
}
}
}
return eventDetails;
}
开发者ID:karthik20522,项目名称:EventViewer,代码行数:39,代码来源:Program.cs
示例4: Solve
public void Solve(string url)
{
_browser = new IE(url);
_puzzle = ParsePuzzle();
var solver = new Solver();
//solver.Reduced += SolverOnReduced;
solver.Solve(_puzzle);
SolverOnReduced(null, null);
if (_puzzle.IsSolved)
{
return;
}
if (File.Exists("e:\\out.html"))
{
File.Delete("e:\\out.html");
}
File.WriteAllText("e:\\out.html", GetPuzzleHtml());
}
开发者ID:druttka,项目名称:NShoshin,代码行数:25,代码来源:WatinRunner.cs
示例5: home_page_should_have_vidpub_name
public void home_page_should_have_vidpub_name() {
using (var browser = new IE("http://localhost:1701")) {
Assert.True(browser.Title.Contains("VidPub"));
}
}
开发者ID:kodoroph,项目名称:mvc3,代码行数:7,代码来源:HomePage.cs
示例6: CloseIEInstance
/// <summary>
/// Closes the given IE instance.
/// </summary>
/// <param name="ieInstance">The IE instance to be closed.</param>
public static void CloseIEInstance(IE ieInstance)
{
if (ieInstance != null)
{
ieInstance.Close();
}
}
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:11,代码来源:WatiNUtil.cs
示例7: ForceBrowserClose
public Result ForceBrowserClose(bool forceClose)
{
if (isLocal || forceClose)
{
try
{
browser = new IE(Urls.Root);
browser.WaitForComplete();
}
catch (Exception e)
{
Console.WriteLine("BaseFixture.ForceBrowserForDatabaseReset: " + e.ToString());
Thread.Sleep(500);
browser = new IE(Urls.Root);
browser.WaitForComplete();
}
CloseBrowser(forceClose);
}
return Result.CreatePass();
}
开发者ID:ihenehan,项目名称:Behavior,代码行数:26,代码来源:BaseFixture.cs
示例8: GetControl
public static AttributeConstraint GetControl(IE ie, HControl control)
{
//Regex regex = new Regex(FilterPattern.GetToPattern(control.Value));
String regex = control.Value;
switch (control.Attribute.ToLower())
{
case AttributeType.Id:
return Find.ById(regex);
case AttributeType.Name:
return Find.ByName(regex);
case AttributeType.Class:
return Find.ByClass(regex);
case AttributeType.Text:
{
Regex regexs = new Regex(FilterPattern.GetToPattern(control.Value));
return Find.ByText(regexs);
}
case AttributeType.Value:
{
Regex regexs = new Regex(FilterPattern.GetToPattern(control.Value));
return Find.ByValue(regexs);
}
default:
return Find.ByName(regex);
}
}
开发者ID:phinq19,项目名称:qlcongviec,代码行数:26,代码来源:MyWatiN.cs
示例9: frmWebBowser_Load
private void frmWebBowser_Load(object sender, EventArgs e)
{
webBrowser1.ScriptErrorsSuppressed = true;
//IE.Settings.AutoStartDialogWatcher = false;
WatiN.Core.Settings.AutoStartDialogWatcher = false;
ie = new IE(webBrowser1.ActiveXInstance);
}
开发者ID:phinq19,项目名称:qlcongviec,代码行数:7,代码来源:frmWebBowser.cs
示例10: HomePageContainsFreshOffTheGrillAlbumList
public void HomePageContainsFreshOffTheGrillAlbumList()
{
using (var browser = new IE("http://localhost:1200/"))
{
Assert.IsTrue(browser.List(Find.ById("album-list")).Children().Any());
}
}
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:7,代码来源:HomePageTests.cs
示例11: Goto
public static string Goto(String text, IE ie)
{
int i = 0;
while (i < Loop)
{
i++;
try
{
ie.GoTo(text);
ie.WaitForComplete();
//ie.WaitUntilContainsText("message");
return string.Empty;
}
catch (Exception ex)
{
if (i == Loop)
{
return ex.Message;
}
ie.Close();
Thread.Sleep(60000);
ie.Reopen();
}
}
return string.Empty;
}
开发者ID:phinq19,项目名称:qlcongviec,代码行数:26,代码来源:MyCore.cs
示例12: HomePageContainsPromotionPanel
public void HomePageContainsPromotionPanel()
{
using (var browser = new IE("http://localhost:1200/"))
{
Assert.IsTrue(browser.Div(Find.ById("promotion")).Exists);
}
}
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:7,代码来源:HomePageTests.cs
示例13: Solve
public void Solve(string url)
{
_browser = new IE(url);
_puzzle = ParsePuzzle();
var solver = new GuessingSolver();
// solver.Reduced += SolverOnReduced;
solver.Solve(_puzzle);
SolverOnReduced(null, null);
if (_puzzle.IsSolved)
{
return;
}
if(_puzzle.HasErrors)
{
System.Console.WriteLine("Puzzle has Errors");
}
var tempPath = Path.GetTempPath();
string tempFileName;
do
{
tempFileName = Path.Combine(tempPath, Guid.NewGuid().ToString().Remove(8) + ".html");
} while (File.Exists(tempFileName));
File.WriteAllText(tempFileName, GetPuzzleHtml());
Process.Start(tempFileName);
}
开发者ID:hallipr,项目名称:NShoshin,代码行数:33,代码来源:WatinRunner.cs
示例14: LocatingThings
public void LocatingThings()
{
using (var browser =
new IE("http://www.pluralsight.com"))
{
//// Get a reference to a HTML input element, type=text, id=Name
//TextField applicantName = browser.TextField(Find.ById("Name"));
//// Get a reference to a HTML link element with id=HelpLink
//Link helpHyperlink = browser.Link(Find.ById("HelpLink"));
//// Get a reference to a HTML input element, type=submit, id=ApplyNow
//Button applyButton = browser.Button(Find.ById("ApplyNow"));
//// Get a reference to a HTML paragraph element, id=Name
//Para nameParagraph = browser.Para(Find.ById("Name"));
TextField applicantName = browser.TextField(Find.ById("Name"));
Link helpHyperlink = browser.Link(Find.ById("HelpLink"));
Button applyButton = browser.Button(Find.ById("ApplyNow"));
Para nameParagraph = browser.Para(Find.ById("Name"));
}
}
开发者ID:stephenosrajan,项目名称:PSTestingEndToEnd,代码行数:26,代码来源:DemoCodeForSlides.cs
示例15: TestFixtureSetUp
public void TestFixtureSetUp()
{
browser = new IE(BuildUrl("Login", "Index"));
CompleteLoginForm(browser, "johnpolling", "password");
listPluginUrl = BuildUrl("Administrator", "Plugins", "List");
}
开发者ID:pollingj,项目名称:Membrane-CMS,代码行数:7,代码来源:WhenPluginsPageIsRequested.cs
示例16: GivenIHaveAValidLoginAndPassword
public void GivenIHaveAValidLoginAndPassword()
{
using(var browser = new IE("http://localhost:58577/"))
{
}
//ScenarioContext.Current.Pending();
}
开发者ID:mmooney,项目名称:Parallax,代码行数:7,代码来源:StepDefinitions.cs
示例17: Chat
private static void Chat(WebClient client, string path)
{
using (File.Create(path))
{
}
using (var browser = new IE("http://widget.chatvdvoem.ru/iframe?mode=production&height=600"))
{
browser.Link(Find.ById("chat_start")).Click();
var lastAnswer = string.Empty;
var answer = string.Empty;
while (true)
{
var i = 0;
while (string.Equals(lastAnswer, answer,
StringComparison.InvariantCultureIgnoreCase))
{
Thread.Sleep(7000);
i++;
if (i > 4)
{
browser.ForceClose();
return;
}
var froms = browser.Elements.Filter(p => p.ClassName == "messageFrom");
if (froms.Count == 0)
continue;
answer = froms.Last().Text;
answer = answer.Substring(6);
}
lastAnswer = answer;
if (BlackListed(answer))
break;
var question = GetAnswer(client, answer);
File.AppendAllLines(path, new[] { answer, question });
browser.TextField(Find.ByName("text")).TypeText(question);
Thread.Sleep(2000);
browser.Button(Find.ById("text_send")).Click();
}
browser.ForceClose();
}
}
开发者ID:butaji,项目名称:SimSimi.Turing,代码行数:59,代码来源:Program.cs
示例18: SetUp
public virtual void SetUp()
{
IE.Settings.AutoMoveMousePointerToTopLeft = false;
_webServer = new DevWebServer();
_webServer.Start();
_ie = new IE(_webServer.BaseUrl, true);
}
开发者ID:rslijp,项目名称:sharptiles,代码行数:8,代码来源:WebFormsTest.cs
示例19: Verify_WebsiteUp
public void Verify_WebsiteUp()
{
using (var browser = new IE("http://localhost/Sample.Web_deploy"))
{
var hasText = browser.ContainsText("Getting started");
Assert.IsTrue(hasText);
}
}
开发者ID:jiffypopjr,项目名称:JoshLocal,代码行数:8,代码来源:UnitTest1.cs
示例20: PageInteraction
public PageInteraction(IE browser)
{
_browser = browser;
_pageUrls = new PageUrls();
ScenarioContext.Current["username"] = username;
ScenarioContext.Current["password"] = password;
}
开发者ID:mustafamg,项目名称:AccountManager,代码行数:8,代码来源:PageInteraction.cs
注:本文中的WatiN.Core.IE类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论