public void ClickOnAddToList() { DomElement addToListButton = offeringSummary.GetElementWaitByCSS(this.addToListButton.locator); try { Thread.Sleep(5000); addToListButton.webElement.Click(); } catch (Exception) { addToListButton = offeringSummary.GetElementWaitByCSS(this.addToListButton.locator); addToListButton.webElement.Click(); } AddListModal = new AddListModal(base.Driver); offeringSummary.GetElementWaitUntilByXpath(AddListModal.modal.locator, (el) => el.Displayed, 15); }
public APListSummaryPage AddToListByIndex(int index, bool visitList = false, string list = "My List") { List <DomElement> items = catalogSummary.GetElementsWaitByCSS(addToListButton.locator); if (index > items.Count - 1 || index < 0) { index = items.Count - 1; } base.ScrollToTop(); try { Thread.Sleep(5000); items[index].webElement.Click(); } catch (Exception) { items = catalogSummary.GetElementsWaitByCSS(addToListButton.locator); items[index].webElement.Click(); } AddListModal = new AddListModal(base.Driver); catalogSummary.GetElementWaitUntilByXpath(AddListModal.modal.locator, (el) => el.Displayed, 15); AddListModal.SelectList(list); AddListModal.ClickOnAddToListModal(); AddListModal.IsSuccessMessageInModal(); if (visitList) { AddListModal.ClickOnAddToListModal(); return(new APListSummaryPage(Driver)); } else { AddListModal.CloseAddToListModal(); } base.WaitForAppBusy(3); return(null); }