public void LoginToAliExpress(Login login) { bool isAdClosed = false; try { WaitUtilities.WaitForElementNTimes(driver, adsCloseButtonLocator, TimeSpan.FromSeconds(5), 3); Click(AdsCloseButton); WaitUtilities.WaitForElementNTimes(driver, newUserAdNotificationLocator, TimeSpan.FromSeconds(5), 3); isAdClosed = true; } catch (NoSuchElementException e) { Console.WriteLine("DEBUG: Could not locate ad: " + e.Message); } WaitUtilities.WaitForElementNTimes(driver, goToGlobalSiteLinkLocator, TimeSpan.FromSeconds(5), 3); wait.Until(ExpectedConditions.ElementToBeClickable(goToGlobalSiteLinkLocator)); Click(GoToGlobalSiteLink); if (!isAdClosed) { try { WaitUtilities.WaitForElementNTimes(driver, adsCloseButtonLocator, TimeSpan.FromSeconds(5), 3); Click(AdsCloseButton); WaitUtilities.WaitForElementNTimes(driver, newUserAdNotificationLocator, TimeSpan.FromSeconds(5), 3); isAdClosed = true; } catch (NoSuchElementException e) { Console.WriteLine("DEBUG: Could not locate ad: " + e.Message); } } WaitUtilities.WaitForElementNTimes(driver, signInButtonLocator, TimeSpan.FromSeconds(5), 3); Click(SignInButton); WaitUtilities.WaitForElementNTimes(driver, aliExpressLoginFormLocator, TimeSpan.FromSeconds(5), 3); driver.SwitchTo().Frame(AliExpressLoginForm); WaitUtilities.WaitForElementNTimes(driver, loginFieldLocator, TimeSpan.FromSeconds(5), 3); SendText(LoginField, login.login); WaitUtilities.WaitForElementNTimes(driver, passwordFieldLocator, TimeSpan.FromSeconds(5), 3); SendText(PasswordField, login.password); WaitUtilities.WaitForElementNTimes(driver, loginSubmitButtonLocator, TimeSpan.FromSeconds(5), 3); Click(LoginSubmitButton); }
public MyOrdersPage NavigateToMyOrdersPage() { WaitUtilities.WaitForElementNTimes(driver, myOrdersLinkLocator, TimeSpan.FromSeconds(5), 3); Click(MyOrdersLink); return(new MyOrdersPage(driver, wait)); }