public void GetElementsAsListTest() { var elementActions = new ElementActions(Driver); Driver.Url = "http://the-internet.herokuapp.com/"; Assert.IsTrue(elementActions.GetElementsAsList(By.XPath("//ul/li")).Count > 0, "Element list wasn't created."); }
public void CustomDownloadFileLocationTest() { var elementActions = new ElementActions(Driver); Driver.Url = "http://the-internet.herokuapp.com/"; elementActions.Click(By.XPath("//a[text()='File Download']")); var items = elementActions.GetElementsAsList(By.XPath("//div[@class='example']/a")); var downloadFile = items[1].Text; var downloadPath = string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["DownloadLocation"].ToString()) ? $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\\downloads\\" : System.Configuration.ConfigurationManager.AppSettings["DownloadLocation"]; FileHelper.DeleteFile(downloadPath, downloadFile); elementActions.Click(items[1]); FileHelper.WaitForFileDownload(downloadFile, downloadPath); Assert.IsTrue(File.Exists($"{downloadPath}\\{downloadFile}"), "The file wasn't downloaded successfully."); }