private void GetPhotos(string path, Action openPhotosView, int downloadCount) { openPhotosView(); _userProfilePage.WaitToPhotosViewCounter(); //Thread.Sleep(450); //if (!_userProfilePage.IsPhotosViewOpened()) //{ // return; //} for (int i = 1; i <= downloadCount && i <= _userProfilePage.GetPhotosCountInPhotoView(); i++) { var photoName = $"{Path.GetFileNameWithoutExtension(path)}_{i}.{Path.GetExtension(path)}"; var dirPath = Path.GetDirectoryName(path); var url = _userProfilePage.GetPhotoUrlInPhotosView(); //Downloading photo Thread photoThread = new Thread(() => DownloadAndSavePhoto(url, Path.Combine(dirPath, photoName))); photoThread.Start(); if (i != _userProfilePage.GetPhotosCountInPhotoView()) { //Going to the next picture in the galery _userProfilePage.WaitUntilImageLoads(); _userProfilePage.GoRightInPhotosView(); //_userProfilePage.WaitUntilImageChanges(url); //Thread.Sleep(500); } } if (_userProfilePage.IsPhotosViewOpened()) { _userProfilePage.ClosePhotosView(); } Configs.Logger.Debug($"Photos from one of albums was gathered | Profile: {_userProfilePage.GetId()}"); }