本文整理汇总了C#中ISelenium.IsElementPresent方法的典型用法代码示例。如果您正苦于以下问题:C# ISelenium.IsElementPresent方法的具体用法?C# ISelenium.IsElementPresent怎么用?C# ISelenium.IsElementPresent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISelenium
的用法示例。
在下文中一共展示了ISelenium.IsElementPresent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupClass
public void SetupClass()
{
base.StartServer();
selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]);
selenium.Start();
verificationErrors = new StringBuilder();
selenium.DeleteAllVisibleCookies();
selenium.Open("/dna/mbfood/");
// To Do
// too general, could crash test if a topic happened to have the wrong name
Assert.IsFalse(selenium.IsTextPresent("error"));
Assert.IsFalse(selenium.IsTextPresent("There has been a problem"));
selenium.Click("link=Sign in");
selenium.Click("bbcid_username");
selenium.Type("bbcid_username", "mpgsuper");
selenium.Type("bbcid_password", "ratbags");
selenium.Click("signin");
selenium.WaitForPageToLoad("30000");
// going this way so as to be certain to get the right site options without thinking about it
selenium.Click("link=Site Options");
selenium.WaitForPageToLoad("30000");
// check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines
Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle());
Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']");
stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value");
valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']");
}
示例2: VerifyContactusPage
///<summary>
/// This method verifies the details on COntact Us page
/// <example>VerifyContactusPage(MyBrowser)</example>
public void VerifyContactusPage(ISelenium browser)
{
try
{
HGFcommonObj.selectMenuButton(browser);
HGFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink);
Thread.Sleep(1000);
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.lostLoginButton), "Lost Login button is not present in mobile's login page");
HGFcommonObj.clickObject(browser, LoginLogoutControls.lostLoginButton);
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.contactUsBanner), "'Contact us' banner is not present in the Contact Us page");
Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page");
Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page");
Console.WriteLine("UI Verification of Contact us page via 'Lost Login' was successful");
HGFcommonObj.SelectLinksFromSideBar(browser, "Contact us", "Contact Us");
Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page");
Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page");
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page");
Console.WriteLine("UI Verification of Contact us page via 'Side Menu' was successful");
}
catch (Exception ex)
{
Console.WriteLine("Function 'VerifyContactusPage' - Failed");
Console.WriteLine(ex.Message);
Fail(ex.Message);
}
}
示例3: ValidatePopupsofNFR
///<summary>
/// This method Clicks on the NRF links and validates the URl opened in the new browser
/// <example>ValidatePopupsofNFR(MyBrowser, "xPath", "Ladbrokes LBR", "https://www.gibraltar.gov.gi/remotegambling");
public void ValidatePopupsofNFR(ISelenium browser, string xPath, string newWindowTitle, string expURL)
{
try
{
browser.Click(xPath);
HGframeworkCommonObj.PageSync(browser);
HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
Thread.Sleep(1000);
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link");
Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container");
Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container");
browser.Click(LoginLogoutControls.CloseButtonInAlertContainer);
HGframeworkCommonObj.PageSync(browser);
Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button");
browser.Click(xPath);
HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
Thread.Sleep(1000);
Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link");
browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer);
HGframeworkCommonObj.PageSync(browser);
Thread.Sleep(2000);
HGFcommonObj.SwitchWindow(browser, newWindowTitle);
string actUrl = browser.GetLocation();
// url = driver.Url;
browser.Close();
browser.SelectWindow("null");
Thread.Sleep(1000);
if (actUrl.ToLower().Trim() != expURL.ToLower().Trim())
{
Console.WriteLine("Mismatch in URL's. Actual '" + actUrl + "', Expected '" + expURL + "'.");
}
}
catch (Exception ex)
{
Console.WriteLine("Function 'ValidatePopupsofNFR' - Failed");
Console.WriteLine(ex.Message);
Fail(ex.Message);
}
}
示例4: EventDisplayStatusValidation
/// <summary>
/// Method to update and validate event display status validation
/// </summary>
public void EventDisplayStatusValidation(ISelenium browser, ISelenium adminBrowser, TestData testData, string navPanel,string eventName)
{
try
{
#region Event Display Status Validation
adminCommonObj.UpdateEventsDisplaySts(adminBrowser, testData.CategoryName, testData.ClassName, testData.TypeName, testData.SubTypeName, testData.EventName, "No");
Thread.Sleep(FrameGlobals.OpenBetReflectTimeOut);
Console.WriteLine("Event Display status is updated in admin");
btCommonObj.NavigateToSportsPage(browser, testData.ClassName, navPanel, testData.ClassName);
Assert.IsFalse(browser.IsElementPresent("//li/a/div[contains(text(), '" + eventName + "')]/following-sibling::div[contains(text(), '" + testData.TypeName + "')]/following-sibling::div[@class='bxcl mr5 arrow next-arrow']"),
"Event is still displayed after update");
#endregion
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
CaptureScreenshot(browser, "EventDisplayStatusValidation");
}
}
示例5: RegisterCustomer_selfExclusion
//.........这里部分代码省略.........
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);
//Validate registration
clickObject_MobileLobby(browser, MobileLobbyControls.registerNow);
Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration");
Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed");
regMsg = "We are sorry but your country of residence is currently prohibited from using the Ladbrokes service.";
xPath = "//ul[@class='error_align']/li[contains(text()[2], '" + regMsg + "')]";
Assert.IsTrue(browser.IsElementPresent(xPath), "Registration failure message was not displayed to the user");
Assert.IsTrue(browser.IsVisible(MobileLobbyControls.contactMessage), "Customer contact message was not displayed on failing to create a customer from banned country");
Console.WriteLine("Customer was not registered as his details provided matched a self excluded customer");
}
catch (Exception ex)
{
CaptureScreenshot(browser, "EnterRegisterDetails");
Console.WriteLine("Function 'EnterRegisterDetails' - Failed");
Console.WriteLine(ex.Message);
Fail(ex.Message);
}
}
示例6: AgeVerification
/// <summary>
/// Adding a Reward Adhoc token to customer in Admin.
/// </summary>
/// Date Created:
/// Author: Anand C
/// User should be login to Admin application
/// <param name="adminBrowser">Browser Instance</param>
/// <param name="custName">Customer name for whom the token be added</param>
/// <param name="tokenVal">token value to be added</param>
public bool AgeVerification(ISelenium adminBrowser, string cardNum, string issueNum, string CustomerName)
{
try
{
Framework.Common.Common FrameWKCommon = new Framework.Common.Common();
//Click on Customer Verification button
if (!AdminTableObjects(adminBrowser, "Customer attributes", "", "Button", "Customer Verification", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable to click on Customer Verification button in Customer attributes table");
return false;
}
Assert.IsTrue(adminBrowser.IsElementPresent(AdminSuite.CommonControls.AdminHomePage.custVerifyCountry), "Unable to find country select box in customer verify page");
Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page");
adminBrowser.Click("//input[@type='radio' and @value = 'A']");
//Entering value in OVS Score: Text box in Customer verification page
if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "OVS Score", "Text Box", "100", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable to put value in OVS Score Text box in Manually Verify Customer page");
return false;
}
//Entering value in Reference: Text box in Customer verification page
if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Reference", "Text Box", "100", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable to put value in Reference Text box in Manually Verify Customer page");
return false;
}
//Entering value in Notes Text box in Customer verification page
if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Notes", "Text Box", "Notes", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable to put value in Notes Text box in Manually Verify Customer page");
return false;
}
Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page");
adminBrowser.Click("//input[@type='radio' and @value = 'A']");
//Entering value in Driving Licence No Text box in Customer verification page
if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Driving Licence No", "Text Box", "Notes", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable to put value in Driving Licence No Text box in Manually Verify Customer page");
return false;
}
//Click on Add Payment Method button
if (!AdminTableObjects(adminBrowser, "Add payment method", "", "Button", "Add Payment Method", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable click on Add Payment Method button in New Payment Method page");
return false;
}
adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Thread.Sleep(5000);
Console.WriteLine("Successfully added payment method for customer");
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
return false;
}
}
示例7: VerifySelectionData
/// <summary>
/// Verifying selection data
/// </summary>
/// <param name="browser">Browser instance</param>
/// <param name="testData">TestData</param>
public void VerifySelectionData(ISelenium browser, TestData testData)
{
string selectionStatus = string.Empty;
string selectionDisplay = string.Empty;
string selectionPrice = string.Empty;
bool updateSelectionFlg = false;
if (_frameworkCommon.WaitUntilElementPresent(browser, "name=OcDesc", "60") == true)
{
selectionStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx);
selectionDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx);
selectionPrice = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx);
if ("a" != selectionStatus.ToLower())
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=Active");
Console.WriteLine("Updated selection status to Active");
updateSelectionFlg = true;
}
if ("y" != selectionDisplay.ToLower())
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=Yes");
Console.WriteLine("Updated selection display to Yes");
updateSelectionFlg = true;
}
if (testData.Odds != selectionPrice)
{
browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, testData.Odds);
Console.WriteLine("Updated selection price from test data");
updateSelectionFlg = true;
}
if (updateSelectionFlg)
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn))
{
browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn);
browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
}
else
{
Console.WriteLine("Unable to update the event in Openbet");
}
Thread.Sleep(3000);
}
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
}
示例8: VerifyEventData
/// <summary>
/// Verifying event details data in openbet
/// </summary>
/// <param name="browser">Browser instance</param>
/// <param name="testData">Test data</param>
public void VerifyEventData(ISelenium browser, TestData testData)
{
//IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
string eventStatus = string.Empty;
string eventDisplay = string.Empty;
bool updateEventFlg = false;
//Wait Untill the EventDetails Page loads
if (_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
{
eventStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox);
eventDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx);
if ("a" != eventStatus.ToLower())
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active");
Console.WriteLine("Updated Event status to Active");
updateEventFlg = true;
}
if ("y" != eventDisplay.ToLower())
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes");
Console.WriteLine("Updated Event display to Yes");
updateEventFlg = true;
}
if (updateEventFlg)
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn))
{
browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull");
}
else
{
Console.WriteLine("Unable to update the event in Openbet");
}
}
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
}
示例9: UpdatePayMtd
/// <summary>
/// Adding a Reward Adhoc token to customer in Admin.
/// </summary>
/// Date Created:
/// Author: Anand C
/// User should be login to Admin application
/// <param name="adminBrowser">Browser Instance</param>
/// <param name="custName">Customer name for whom the token be added</param>
/// <param name="tokenVal">token value to be added</param>
public bool UpdatePayMtd(ISelenium adminBrowser, string cardNum, string status, string CustomerName)
{
try
{
//Click on Debit/Credit link
/*if (!AdminTableObjects(adminBrowser, "Customer Payment Methods", cardNum.Substring(cardNum.Length - 4, 4), "Link", "", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser);
Console.WriteLine("Unable to put value in Card Search Text box in Card Search page");
return false;
}*/
Assert.IsTrue(adminBrowser.IsElementPresent("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a"), cardNum + " card is not available for this customer: " + CustomerName);
adminBrowser.Click("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a");
adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
//
Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='status']"), "Authorisation status list box is not visible");
Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_dep']"), "Authorisation deposit list box is not visible");
Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_wtd']"), "Authorisation withdrawal list box is not visible");
adminBrowser.Select("//select[@name='status']", status);
adminBrowser.Select("//select[@name='auth_dep']", "Yes");
adminBrowser.Select("//select[@name='status_dep']", "Active");
adminBrowser.Select("//select[@name='auth_wtd']", "Yes");
adminBrowser.Select("//select[@name='status_wtd']", "Active");
//click on the Update Payment Method button
if (!AdminTableObjects(adminBrowser, "Authorisation", "", "Button", "Update Payment Method", 1))
{
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
Console.WriteLine("Unable click on Payment Method button in Customer Payment page");
return false;
}
adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Thread.Sleep(5000);
Console.WriteLine("Successfully searched the customer");
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Framework.BaseTest.CaptureScreenshot(adminBrowser, "");
return false;
}
}
示例10: UpdateMarketStatus
/// <summary>
/// To Update Markt Status
/// </summary>
/// <param name="browser">Selenium browser instance</param>
/// <param name="catName">Category Name</param>
/// <param name="eventClsName">Event ClassName</param>
/// <param name="eventTypeName">Event TypeName</param>
/// <param name="eventSubType">Event SubType</param>
/// <param name="eventName">Event Name</param>
/// <param name="eventStatus">Event Display Status</param>
public void UpdateMarketStatus(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string mktName, string marketStatus)
{
string errorMessage = "";
bool eventUpdationStatus = false;
bool finalEventStatus = true;
Framework.Common.Common frameworkcommon = new Framework.Common.Common();
AdminSuite.Common com = new AdminSuite.Common();
Framework.Common.Common Fcommon = new Framework.Common.Common();
TimeSpan ts = new TimeSpan(0, 1, 0);
IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
//Clicking on Event Link in LHN
LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
//Selecting TopFrame
SelectMainFrame(browser);
System.Threading.Thread.Sleep(10000);
frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
catName = catName.Replace("|", "").Trim();
if (catName != "")
{
Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
}
eventClsName = eventClsName.Replace("|", "").Trim();
if (eventClsName != "")
{
Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
}
if (eventTypeName != "")
{
Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
}
Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");
// Selecting Daterange
browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");
//Clicking on Seach button
browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
_frameworkCommon.WaitUntilAllElementsLoad(browser);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
// Wait for Element to present
if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
{
browser.Click("link=" + eventName);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Thread.Sleep(10000);
//Wait Untill the EventDetails Page loads
if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true)
{
if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + "|" + mktName + "|" + "", "60") == true)
{
//browser.Click("link=" + mktName);
browser.Click("link=" + "|" + mktName + "|");
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
if (marketStatus == "Suspend")
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended");
eventUpdationStatus = false;
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
else
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
}
//Updating the Event
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton))
{
if (eventUpdationStatus == false)
{
browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "markrt display status Updation is not Successfull");
browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
}
}
}
}
else
//.........这里部分代码省略.........
示例11: UnLockTheLockedUser
/// <summary>
/// Unlock the User which is locked
/// </summary>
/// Author: Anand
/// <param name="browser">browser Instance</param>
/// <param name="userName">User Name</param>
public void UnLockTheLockedUser(ISelenium browser, string userName)
{
decimal numberOfAciveRow;
string amend = "//input[@value='Amend Status Flags']";
// Enter Customer Name and Search
SearchCustomer(userName, browser);
// Click on Amend Status Flag
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
SelectMainFrame(browser);
if (browser.IsElementPresent(amend))
browser.Click(amend);
System.Threading.Thread.Sleep(5000);
// Get Number of Active rows where user should be unlocked
numberOfAciveRow = browser.GetXpathCount("//tbody/tr[@class='active']");
if (numberOfAciveRow > 0)
{
for (int i = 0; i < numberOfAciveRow; i++)
{
browser.Click("link=[clear]");
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
System.Threading.Thread.Sleep(5000);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
Console.WriteLine("AdminSuite:Common:UnLockTheLockedUser-Pass: User " + userName + " Unlocked ");
}
}
示例12: StoreAgeVerification
/// <summary>
/// Stores age evrification details for a customer
/// </summary>
/// Author: Kiran
/// <param name="browser">browser Instance</param>
/// <param name="userName">User Name</param>
/// <param name="segmentType">HVC</param>
/// <param name="segmentVal">Yes</param>
public bool StoreAgeVerification(ISelenium adminBrowser, string userName, string ageVerStatus, int ovsScore, string ovsRef, string notes, string driverLinNo)
{
try
{
// Enter Customer Name and Search
SearchCustomer(userName, adminBrowser);
SelectMainFrame(adminBrowser);
adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.custVerificationBtn);
adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(adminBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusPassRdo), "Customer Verification page not loaded");
if (ageVerStatus.ToLower() == "pass")
{
adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusPassRdo);
}
else
{
adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ageVerfStatusFailRdo);
}
adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.ovsReferenceTxt, ovsRef);
adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.notesTxt, notes);
adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.driversRdo);
adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.driverNoTxt, driverLinNo);
adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.strVerificationBtn);
adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(adminBrowser.IsTextPresent("Verification check stored successfully for customer"), "Failed to store verification");
return true;
}
catch (Exception ex)
{
CaptureScreenshot(adminBrowser, "");
Console.WriteLine(ex);
return false;
}
}
示例13: SearchEvent
/// <summary>
/// Search for an Event
/// </summary>
/// <param name="browser">Selenium browser instance</param>
/// <param name="catName">Category Name</param>
/// <param name="eventClsName">Event ClassName</param>
/// <param name="eventTypeName">Event TypeName</param>
/// <param name="eventSubType">Event SubType</param>
/// <param name="eventName">Event Name</param>
/// <param name="eventStatus">Event Status</param>
public bool SearchEvent(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName)
{
try
{
bool eventFound = false;
TimeSpan ts = new TimeSpan(0, 1, 0);
IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
//Clicking on Event Link in LHN
LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
//Selecting TopFrame
System.Threading.Thread.Sleep(10000);
SelectMainFrame(browser);
_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60");
catName = catName.Replace("|", "").Trim();
if (catName != "")
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx))
{
Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName);
}
}
eventClsName = eventClsName.Replace("|", "").Trim();
if (eventClsName != "")
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx))
{
Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName);
}
}
if (eventTypeName != "")
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx))
{
Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName);
}
}
if (eventSubType != "")
{
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx))
{
Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present");
browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType);
}
}
Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing");
// Selecting Daterange
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx))
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--");
}
//Clicking on Seach button
browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn);
_frameworkCommon.WaitUntilAllElementsLoad(browser);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
//Thread.Sleep(2000);
// Wait for Element to present
if (_frameworkCommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true)
{
browser.Click("link=" + eventName);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
eventFound = true;
}
return eventFound;
}
catch (Exception ex)
{
CaptureScreenshot(browser, "");
Fail(ex.Message);
return false;
}
}
示例14: UpdateEventStartDateTimeBySelectionID
public void UpdateEventStartDateTimeBySelectionID(ISelenium browser, string selectionID, string startDateTime)
{
try
{
//Clicking on Event Link in LHN
LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
//Selecting TopFrame
SelectMainFrame(browser);
browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut);
browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID);
browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Even outcome");// 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 present in the selection page
browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page
browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
string startTimeXpath = "//input[@name='EvStartTime']";
browser.Type(startTimeXpath, startDateTime);
//if (browser.IsElementPresent(startTimeXpath))
//{
// //startTime = browser.GetText(startTimeXpath);
// startTime = browser.GetValue(startTimeXpath);
//}
//Updating the Event
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn))
{
browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
Console.WriteLine(ex.Message);
//return null;
}
}
示例15: UpdateMarketByMarketID
/// <summary>
/// Update market by Market id in Open bet
/// </summary>
/// <param name="browser">Browser instance</param>
/// <param name="marketId">Market id</param>
/// <param name="marketStatus">Market status</param>
/// <param name="marketDisplayed">Display</param>
public void UpdateMarketByMarketID(ISelenium browser, string marketId, string marketStatus, string marketDisplayed)
{
try
{
//Clicking on Event Link in LHN
LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
//Selecting TopFrame
SelectMainFrame(browser);
browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut);
browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, marketId);
browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Event market");// 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 present in the selection page
//browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
if (string.Empty != marketStatus)
{
if (marketStatus == "Suspend")
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended");
}
else if (marketStatus == "Active")
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active");
}
else
{
throw new AutomationException("Market status is invalid.");
}
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
}
if (string.Empty != marketDisplayed)
{
if (marketDisplayed == "Yes")
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes");
}
else if (marketDisplayed == "No")
{
browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=No");
}
else
{
throw new AutomationException("Market displayed is invalid.");
}
}
//update Market
if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton))
{
browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Market Updation is not Successfull");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
Console.WriteLine(ex.Message);
//return null;
}
}