public Boolean selectTradeLink(string expectedVin) { Boolean isSuccessful = false; try { //Click(By.XPath("//div[10]//div[@class='tm-grid-icon-label']")); Actions action = new Actions(Driver.GetDriver()); IWebElement shortCutMenulink = Driver.GetDriver().FindElement(By.XPath("//div[@class='tm-icon actions-cell ng-star-inserted']/i[@class='toyota-icon more-vert']")); action.MoveToElement(shortCutMenulink).Click().Build().Perform(); Driver.GetDriver().Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30); if (TradeLink.Displayed) { Console.WriteLine("Trade Link is found"); TradeLink.Click(); Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); Console.WriteLine("Trade Popup Title======" + TradePopupTitle.Text); if ((TradePopupTitle.Text.Trim() == "Trade vehicles") && (TradeWindowVin.Text.Contains(expectedVin))) { isSuccessful = true; Console.WriteLine("Trade Link was found and clicked fine."); } } } catch (StaleElementReferenceException ex) { Console.WriteLine(ex.StackTrace); } return(isSuccessful); }
public Boolean AccessTradePopup() { Boolean isTradePopoupAppear = false; try { Console.WriteLine("Found Vehicle in Status=====> " + GetVechileInventoryStatus()); if ((GetVechileInventoryStatus().Contains("AVAILABLE")) || (GetVechileInventoryStatus().Contains("ALLOCATED")) || (GetVechileInventoryStatus().Contains("IN TRANSIT"))) { Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); if (QuickActionsLnk.Displayed == true) { Console.WriteLine("Quick Actions link is present."); QuickActionsLnk.Click(); Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); if (TradeLink.Displayed) { Console.WriteLine("Trade link is present."); TradeLink.Click(); Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); Wait.Until(x => (TradeDialog.Displayed != true)); Driver.GetDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); Console.WriteLine("Trade Popup Title======" + TradePopupTitle.Text); if (TradePopupTitle.Text.Trim() == "Trade vehicles") { isTradePopoupAppear = true; } } } else { Console.WriteLine("Unable to see Quick Actions Link from Vehicle Detail Page."); } } else { Console.WriteLine("Status of Vehicle was not tradeable. Olease check the vin before you execute." + GetVechileInventoryStatus()); } } catch (Exception e) { Console.WriteLine("Unable to access Trade Popup to make trade." + e.StackTrace); } return(isTradePopoupAppear); }