本文整理汇总了C#中ISelenium.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# ISelenium.GetText方法的具体用法?C# ISelenium.GetText怎么用?C# ISelenium.GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISelenium
的用法示例。
在下文中一共展示了ISelenium.GetText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterCustomer_selfExclusion
///<summary>
/// This method creates a customer with the same details of a self exclusion customer
/// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example>
public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser)
{
try
{
string regMsg, gender, xPath;
var admincommonObj = new AdminSuite.Common();
Random rnd = new Random();
int rndNumber = rnd.Next(10000);
//get details of customer in OB
adminBrowser.WindowFocus();
string username = "AutoUser" + rndNumber;
admincommonObj.SelectMainFrame(adminBrowser);
string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td");
string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td");
string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td");
if (title.ToLower() == "mr")
{
gender = "male";
}
else
{
gender = "female";
}
string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td");
string[] arr = dob.Split('-');
string DOByear = arr[0];
System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString();
string DOBday = arr[2];
string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td");
string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td");
string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td");
string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td");
string teleCode = "+44";
string telnumber = "1234567890";
string mobnumber = "1234512345";
string password = "12345678";
string confirmPassword = "12345678";
string securityQuestion = "Favourite Colour";
string securityAnswer = "Blue";
string accountCurrency = "UK Pound Sterling";
string country = "United Kingdom";
browser.WindowFocus();
WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout);
Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed");
//Enter data in all the fields
browser.Type(MobileLobbyControls.promocode, "");
browser.Select(MobileLobbyControls.title, title);
browser.Type(MobileLobbyControls.firstname, firstname);
browser.Type(MobileLobbyControls.lastname, lastname);
//gender
if (gender.ToLower().Trim() == "male")
{
browser.Click(MobileLobbyControls.genderMale);
}
else
{
browser.Click(MobileLobbyControls.genderFemale);
}
browser.Select(MobileLobbyControls.DOBday, DOBday);
browser.Select(MobileLobbyControls.DOBmonth, DOBmonth);
browser.Select(MobileLobbyControls.DOByear, DOByear);
browser.Select(MobileLobbyControls.country, country);
browser.Type(MobileLobbyControls.housename, houseno);
browser.Type(MobileLobbyControls.postcode, postcode);
browser.Type(MobileLobbyControls.address1, address1);
browser.Type(MobileLobbyControls.address2, address2);
browser.Type(MobileLobbyControls.city, city);
browser.Type(MobileLobbyControls.email, email);
browser.Type(MobileLobbyControls.telintcode, teleCode);
browser.Type(MobileLobbyControls.telnumber, telnumber);
browser.Type(MobileLobbyControls.mobintcode, teleCode);
browser.Type(MobileLobbyControls.mobnumber, mobnumber);
browser.Select(MobileLobbyControls.accountCurrency, accountCurrency);
browser.Type(MobileLobbyControls.username, username);
browser.Type(MobileLobbyControls.password, password);
browser.Type(MobileLobbyControls.confirmPassword, confirmPassword);
browser.Select(MobileLobbyControls.securityQuestion, securityQuestion);
browser.Type(MobileLobbyControls.securityAnswer, securityAnswer);
MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on");
MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on");
Thread.Sleep(1000);
//.........这里部分代码省略.........
示例2: GetCustLastName
/// <summary>
/// This method gets the customer's last name
/// </summary>
/// <Author>Kiran</Author>
/// <Date>10 July 2012</Date>
/// <param name="browser">Browser Instance</param>
/// <param name="custName">name of the customer</param>
/// <example>GetCustLastName(browser, Livetestgbp)</example>
public string GetCustLastName(ISelenium browser, string custName)
{
string lName = "";
try
{
if (AdminSearchCustomer(browser, custName) == true)
{
lName = browser.GetText("//td/table/tbody/tr/td[@class='caption' and contains(text(), 'First Name')]/following-sibling::td");
}
return lName;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
}
示例3: UpdatePayoutFraction
/// <summary> Updates the PayoutFraction
/// Author: Yogesh
/// Date Created: FEb 29 2012
/// </summary>
/// <param name="browser">Selenium browser Instance</param>
/// <param name="selectionId">Selection Id of the selection</param>
/// <param name="updatePayoutFractionNumerator">Payout fraction numerator</param>
/// <param name="updatePayoutFractionDenominator">Payout fraction denominator</param>
/// Ex: UpdatePayourFraction(browser, "12345678", "1", "2", "3");
/// Returns: Nothing
public void UpdatePayoutFraction(ISelenium browser, string selectionId, string updatePayoutFractionNumerator, string updatePayoutFractionDenominator)
{
try
{
//Clicking on Event Link in LHN
LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
//Selecting TopFrame
SelectMainFrame(browser);
browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId);
browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName);
browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn);
_frameworkCommon.WaitUntilAllElementsLoad(browser);
browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button
string payoutFractionNumerator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']");
string payoutFractionDenominator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']");
if (String.IsNullOrWhiteSpace(payoutFractionNumerator) && String.IsNullOrWhiteSpace(payoutFractionDenominator))
{
browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']", updatePayoutFractionNumerator);
browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']", updatePayoutFractionDenominator);
}
// Updating the market details page
browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
Console.WriteLine(ex.Message);
}
}
示例4: VerifyDecimalFractionalOddType
///<summary>
/// This method verifies the Decimal/Fractional odd type switcher changes the odd thetheir respective format
/// <example>VerifyDecimalFractionalOddType(MyBrowser, "Competition", testDataLst[0].ClassName, testDataLst[0].TypeName, testDataLst[0].SubTypeName, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, "Decimal/Fractional");
public void VerifyDecimalFractionalOddType(ISelenium browser, string sidebarLink, string navPanel, string className, string typeName, string subTypeName, string eventName, string marketName, string selection, string odds, string oddType)
{
try
{
string xPath, actOddType;
IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
HGFbetslipObj.NavigateToEventDetailsPage(browser, sidebarLink, navPanel, className, typeName, subTypeName, eventName, marketName);
//Verify the odd is displayed in the correct format
xPath = "//div[@class='bxcl ml10 odds-text mr2 type' and contains(text(), '" + selection + "')]//following::span[1][@class='odds-convert']";
actOddType = browser.GetText(xPath);
if (oddType.ToLower() == "decimal")
{
Assert.IsTrue(Convert.ToDouble(odds) == Convert.ToDouble(actOddType), "Odd type failed to switch to odd type '" + oddType + "'");
Console.WriteLine("Successfuly validated the Odd type switch to '" + oddType + "'");
}
else
{
Assert.IsTrue(actOddType.Contains("/"), "Odd type failed to switch to odd type '" + oddType + "'");
Console.WriteLine("Successfuly validated the Odd type switch to '" + oddType + "'");
}
}
catch (Exception ex)
{
Console.WriteLine("Function 'VerifyNavigationsFromEventsPage' - Failed");
Console.WriteLine(ex.Message);
Fail(ex.Message);
}
}