本文整理匯總了C#中WatiN.Core.IE.RadioButton方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.RadioButton方法的具體用法?C# IE.RadioButton怎麽用?C# IE.RadioButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.RadioButton方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetSpecificContentWithWatin
static void GetSpecificContentWithWatin()
{
//Kill all ie
Process[] processes = Process.GetProcessesByName("iexplore");
foreach (Process process in processes)
{
process.Kill();
}
HadithDBEntities ctx = new HadithDBEntities();
var hadist = (from c in ctx.Hadiths
where c.HadithID == 1 || c.HadithID == 3 || c.HadithID == 4
select c).ToList();
using (IE ieInstance = new IE())
{
// This will open Internet Explorer browser in maximized mode
ieInstance.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized);
ieInstance.Visible = false;
ieInstance.WaitForComplete();
// This will store page source in categoryPageSource variable
for (int i = 0; i < hadist.Count; i++)
{
var selHadith = hadist[i];
var hadistIndex = (from c in ctx.HadithIndexes
where c.HadithID == selHadith.HadithID
&& c.No != null
orderby c.No
select c).ToList();
for (int j = 0; j < hadistIndex.Count; j++)
{
var selIndex = hadistIndex[j];
var selURL = string.Format("http://sunnah.com/{0}/{1}", selHadith.Name, selIndex.No);
try
{
int HadithOrder = 0;
bool isIndonesian = false;
bool isUrdu = false;
ieInstance.GoTo(selURL);
var RdBtn = ieInstance.RadioButton(Find.ById("ch_indonesian"));
var RdBtn2 = ieInstance.RadioButton(Find.ById("ch_urdu"));
if (ieInstance.Elements.Exists("ch_indonesian") && RdBtn != null)
{
try
{
RdBtn.Click();
ieInstance.WaitForComplete();
Thread.Sleep(500);
// This will wait for the browser to complete loading of the page
isIndonesian = true;
}
catch { }
}
if (ieInstance.Elements.Exists("ch_urdu") && RdBtn2 != null)
{
try
{
RdBtn2.Click();
ieInstance.WaitForComplete();
Thread.Sleep(500);
// This will wait for the browser to complete loading of the page
isUrdu = true;
}
catch { }
}
string HtmlPage = ieInstance.Html;
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(HtmlPage);
HadithChapter selChapter = null;
int ContentCounter = 0;
HadithPage selPage = new HadithPage();
selPage.PageNo = selIndex.No;
selPage.HadithID = selHadith.HadithID;
//get title
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//div"))
{
if (node.Attributes["class"] != null && !string.IsNullOrEmpty(node.Attributes["class"].Value))
{
switch (node.Attributes["class"].Value)
{
case "book_page_english_name":
selPage.Title = node.InnerText.Trim();
break;
case "book_page_arabic_name arabic":
selPage.TitleArabic = node.InnerText.Trim();
//ctx.HadithPages.Add(selPage);
break;
case "chapter":
selChapter = new HadithChapter();
selChapter.HadithID = selHadith.HadithID;
selChapter.PageNo = selPage.PageNo;
//iterate every chapter
//.........這裏部分代碼省略.........
示例2: ScrapWebWatin
static string ScrapWebWatin()
{
Process[] processes = Process.GetProcessesByName("iexplore");
foreach (Process process in processes)
{
process.Kill();
}
// Create an instance of Internet Explorer browser
using (IE ieInstance = new IE("http://sunnah.com/bukhari/1"))
{
// This will open Internet Explorer browser in maximized mode
ieInstance.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized);
ieInstance.Visible = false;
ieInstance.WaitForComplete();
// This will store page source in categoryPageSource variable
var RdBtn = ieInstance.RadioButton(Find.ById("ch_indonesian"));
if (RdBtn != null)
{
RdBtn.Click();
// This will wait for the browser to complete loading of the page
string HtmlPage = ieInstance.Html;
return HtmlPage;
}
}
return string.Empty;
}
示例3: Descargar
public static void Descargar(string rfc, string contrasena, string carpeta, DateTime fechaDesde, DateTime fechaHasta, TipoBusqueda busqueda)
{
using (IE browser = new IE())
{
//limpiar sesion y login
browser.ClearCookies();
Thread.Sleep(1000);
//java login
browser.GoTo("https://portalcfdi.facturaelectronica.sat.gob.mx");
browser.WaitForComplete();
//entrar por contraseña
browser.GoTo("https://cfdiau.sat.gob.mx/nidp/app/login?id=SATUPCFDiCon&sid=0&option=credential&sid=0");
browser.TextField(Find.ByName("Ecom_User_ID")).AppendText(rfc);
browser.TextField(Find.ByName("Ecom_Password")).AppendText(contrasena);
browser.Button("submit").Click();
browser.WaitForComplete();
//ver si nos pudimos loggear
if (browser.ContainsText("Login failed, please try again") || browser.ContainsText("La entrada no se ha completado"))
{
browser.Close();
throw new Exception("Los datos de acceso son incorrectos para: " + rfc);
}
//seleccionar emitidas o recibidas
if (busqueda == TipoBusqueda.Emitidas)
{
browser.RadioButton("ctl00_MainContent_RdoTipoBusquedaEmisor").Click();
}
else
{
browser.RadioButton("ctl00_MainContent_RdoTipoBusquedaReceptor").Click();
}
browser.Button("ctl00_MainContent_BtnBusqueda").Click();
Log.Write("Tipo busqueda", Log.Information);
//Creating the directory if it doesn't exists
if (!System.IO.Directory.Exists(carpeta))
{
System.IO.Directory.CreateDirectory(carpeta);
}
//facturas emitidas
if (busqueda == TipoBusqueda.Emitidas)
{
browser.WaitUntilContainsText("Fecha Inicial de Emisión");
browser.RadioButton("ctl00_MainContent_RdoFechas").Click();
Thread.Sleep(1000);
//fecha desde
browser.TextField("ctl00_MainContent_CldFechaInicial2_Calendario_text").Value = fechaDesde.ToString("dd/MM/yyyy");
//hasta
browser.TextField("ctl00_MainContent_CldFechaFinal2_Calendario_text").Value = fechaHasta.ToString("dd/MM/yyyy");
Thread.Sleep(1000);
//buscar muchas veces por si marca error de lentitud la pagina del sat >(
while (true)
{
browser.Button("ctl00_MainContent_BtnBusqueda").Click();
Thread.Sleep(3000);
if (browser.ContainsText("lentitud"))
{
browser.Link("closeBtn").Click();
}
else
{
break;
}
}
DescargarFacturasListadas(browser, carpeta);
}
else
{
DateTime mesActual = fechaDesde;
bool primeraVez = true;
while (mesActual < fechaHasta)
{
browser.WaitUntilContainsText("Fecha de Emisión");
browser.RadioButton("ctl00_MainContent_RdoFechas").Click();
Thread.Sleep(1000);
//seleccionar año adecuado
browser.SelectList("DdlAnio").SelectByValue(mesActual.Year.ToString());
//seleccionar mes adecuado
browser.SelectList("ctl00_MainContent_CldFecha_DdlMes").SelectByValue(mesActual.Month.ToString());
if (mesActual.Day < 10 && primeraVez)
{
//seleccionar dia adecuado
//click en buscar por que si no no jala
//buscar muchas veces por si marca error de lentitud la pagina del sat >(
//.........這裏部分代碼省略.........
示例4: SetupWebsite
/// <summary>
/// Setups the Test website.
/// </summary>
private void SetupWebsite()
{
IEInstance = new IE();
IEInstance.GoTo("{0}install/default.aspx".FormatWith(TestConfig.TestForumUrl));
IEInstance.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
IEInstance.WaitForComplete(5000);
// Enter Config Password
IEInstance.TextField(Find.ById("InstallWizard_txtEnteredPassword")).TypeText(TestConfig.ConfigPassword);
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepPreviousButton")).Click();
IEInstance.RadioButton(Find.ById("InstallWizard_rblYAFDatabase_1")).Click();
// Enter YAF Database Connection
IEInstance.TextField(Find.ById("InstallWizard_Parameter1_Value")).TypeText(TestConfig.DatabaseServer);
IEInstance.TextField(Find.ById("InstallWizard_Parameter2_Value")).TypeText(TestConfig.TestDatabase);
// Test Database Conncection
IEInstance.Button(Find.ById("InstallWizard_btnTestDBConnection")).Click();
Assert.IsTrue(IEInstance.ContainsText("Connection Succeeded"), "Database Connection Is Wrong");
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();
// Test Mail Setup
IEInstance.TextField(Find.ById("InstallWizard_txtTestFromEmail")).TypeText(TestConfig.TestForumMail);
IEInstance.TextField(Find.ById("InstallWizard_txtTestToEmail")).TypeText("[email protected]");
IEInstance.Button(Find.ById("InstallWizard_btnTestSmtp")).Click();
Assert.IsTrue(
IEInstance.ContainsText("Mail Sent. Verify it's received at your entered email address."),
"Mail Send Failed");
if (TestConfig.UseTestMailServer)
{
SmtpMessage mail = SmtpServer.ReceivedEmail[0];
Assert.AreEqual("[email protected]", mail.ToAddresses[0].ToString(), "Receiver does not match");
Assert.IsTrue(mail.FromAddress.ToString().Contains(TestConfig.TestForumMail), "Sender does not match");
Assert.AreEqual(
"Test Email From Yet Another Forum.NET", mail.Headers["Subject"], "Subject does not match");
Assert.AreEqual(
"The email sending appears to be working from your YAF installation.",
mail.MessageParts[0].BodyView,
"Body does not match");
}
// Now continue to Initialize Database
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();
// Initialize Database
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).ClickNoWait();
IEInstance.WaitUntilContainsText("Create Board", 300);
Assert.IsTrue(IEInstance.ContainsText("Create Board"));
// Board Settings
IEInstance.TextField(Find.ById("InstallWizard_TheForumName")).TypeText(TestConfig.TestApplicationName);
IEInstance.TextField(Find.ById("InstallWizard_ForumEmailAddress")).TypeText(TestConfig.TestForumMail);
// Admin User
IEInstance.TextField(Find.ById("InstallWizard_UserName")).TypeText(TestConfig.AdminUserName);
IEInstance.TextField(Find.ById("InstallWizard_AdminEmail")).TypeText(TestConfig.TestForumMail);
IEInstance.TextField(Find.ById("InstallWizard_Password1")).TypeText(TestConfig.AdminPassword);
IEInstance.TextField(Find.ById("InstallWizard_Password2")).TypeText(TestConfig.AdminPassword);
IEInstance.TextField(Find.ById("InstallWizard_SecurityQuestion")).TypeText(TestConfig.AdminPassword);
IEInstance.TextField(Find.ById("InstallWizard_SecurityAnswer")).TypeText(TestConfig.AdminPassword);
IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).ClickNoWait();
IEInstance.WaitUntilContainsText("Setup/Upgrade Finished", 300);
Assert.IsTrue(IEInstance.ContainsText("Setup/Upgrade Finished"));
IEInstance.Button(Find.ById("InstallWizard_FinishNavigationTemplateContainerID_FinishButton")).ClickNoWait();
IEInstance.WaitUntilContainsText("Welcome Guest!", 300);
Assert.IsTrue(IEInstance.ContainsText("Welcome Guest!"), "Installation failed");
}
示例5: PassportCheck
public string PassportCheck()
{
string strreturn = "";
using (var browser = new IE("https://www.world-check.com/portal/mod_perl/Login/"))
{
if (Find.ByName("username"))
{
browser.TextField(Find.ByName("username")).TypeText("nzrbrt0002");
browser.TextField(Find.ByName("password")).TypeText("Go8ahE5s");
browser.Image(Find.ByName("submitted")).Click();
}
browser.GoTo("https://www.world-check.com/portal/mod_perl/PassportCheck");
browser.TextField(Find.ByName("givenName")).TypeText("Jim");
browser.TextField(Find.ByName("lastName")).TypeText("Smith");
browser.RadioButton(Find.ByName("sexg") && Find.ByValue("M")).Click();
browser.Span(Find.ById("issuingState-CAN")).Click();
browser.TextField(Find.ByName("dateOfBirthDay")).TypeText("29");
browser.TextField(Find.ByName("dateOfBirthMonth")).TypeText("05");
browser.TextField(Find.ByName("dateOfBirthYear")).TypeText("1978");
browser.TextField(Find.ByName("passportNumber")).TypeText("WL745488");
browser.TextField(Find.ByName("expireDateDay")).TypeText("10");
browser.TextField(Find.ByName("expireDateMonth")).TypeText("07");
browser.TextField(Find.ByName("expireDateYear")).TypeText("2014");
browser.Button(Find.ByValue("VERIFY")).Click();
var element = browser.Element(Find.ByClass("tablelinespacer"));
var firsttd = element.NextSibling.NextSibling;
strreturn = firsttd.Text.Replace("Lower Line:","");
//Assert.IsTrue(browser.ContainsText("WatiN"));
}
return strreturn;
}