public string GetPrice() { try { WaitersWrapper.WaitElementInteractable(_frame); IWebElement frame = _webDriver.FindElement(_frame); _webDriver.SwitchTo().Frame(frame); } catch { LoggerWrapper.LogError("Frame wasn't found or XPath (or CSSSelector) is incorrect."); throw; } try { WaitersWrapper.WaitElementVisiable(_totalEstimatedCostLabel); string totalEstimatedCostLabel = _webDriver.FindElement(_totalEstimatedCostLabel).Text; var labelParts = totalEstimatedCostLabel.Split(' '); LoggerWrapper.LogInfo("Pricing label was successfully parsed!"); return(labelParts[4]); } catch { LoggerWrapper.LogError("Pricing label wasn't parse."); throw; } }
public string GetLoggedUserName() { WaitersWrapper.WaitElementInteractable(_webDriver, _accountInfoButton, 10); _webDriver.FindElement(_accountInfoButton).Click(); WaitersWrapper.WaitElementVisiable(_webDriver, _loggedUserName, 10); return(_webDriver.FindElement(_loggedUserName).Text); }
public YopMailMailMainPageObject LoginToMail(User user) { try { WaitersWrapper.WaitElementInteractable(_loginInput); _webDriver.FindElement(_loginInput).Click(); _webDriver.FindElement(_loginInput).SendKeys(user.Login); LoggerWrapper.LogInfo("Login input field was filled!"); } catch { LoggerWrapper.LogError("Login input field: unable to fill."); throw; } try { WaitersWrapper.WaitElementInteractable(_enterButton); _webDriver.FindElement(_enterButton).Click(); LoggerWrapper.LogInfo("Enter button was pushed!"); } catch { LoggerWrapper.LogError("Enter button: unable to push."); throw; } return(new YopMailMailMainPageObject(_webDriver)); }
private void SelectAndChooseOneFromTable(By selectPath, By choosePath, string name) { try { WaitersWrapper.WaitElementInteractable(selectPath); _webDriver.FindElement(selectPath).Click(); LoggerWrapper.LogInfo($"{name} field was found!"); } catch { LoggerWrapper.LogError($"{name} field wasn't found or XPath (or CSSSelector) is incorrect."); throw; } try { WaitersWrapper.WaitElementInteractable(choosePath); _webDriver.FindElement(choosePath).Click(); LoggerWrapper.LogInfo($"{name} field was filled!"); } catch { LoggerWrapper.LogError($"{name} field: unable to fill."); throw; } }
public GoogleCloudPricingCalculatorPageObject SendEmail(string address) { try { WaitersWrapper.WaitElementInteractable(_emailField); _webDriver.FindElement(_emailField).Click(); _webDriver.FindElement(_emailField).SendKeys(address); LoggerWrapper.LogInfo("Email field was filled!"); } catch { LoggerWrapper.LogError("Email field: unable to fill."); throw; } try { WaitersWrapper.WaitElementInteractable(_sendEmailButton); _webDriver.FindElement(_sendEmailButton).Click(); LoggerWrapper.LogInfo("Send email button was pushed!"); } catch { LoggerWrapper.LogError("Send email button: unable to push."); throw; } return(new GoogleCloudPricingCalculatorPageObject(_webDriver)); }
public void Respond(string name) { WaitersWrapper.WaitElementInteractable(_webDriver, _respondButton, 10); _webDriver.FindElement(_respondButton).Click(); WaitersWrapper.WaitElementInteractable(_webDriver, _respondInput, 10); _webDriver.FindElement(_respondInput).SendKeys(name); _webDriver.FindElement(_sendButton).Click(); }
public GoogleAccountSettingsPageObject GoToAccountSettings() { GoToAccountInfo(); WaitersWrapper.WaitElementInteractable(_webDriver, _accountSettingsButton, 10); _webDriver.FindElement(_accountSettingsButton).Click(); _webDriver.SwitchTo().Window(_webDriver.WindowHandles.Last()); return(new GoogleAccountSettingsPageObject(_webDriver)); }
public string UnsuccessfullLogin(string login) { WaitersWrapper.WaitElementInteractable(_webDriver, _loginInputButton, 10); _webDriver.FindElement(_loginInputButton).SendKeys(login); _webDriver.FindElement(_enterButton).Click(); WaitersWrapper.WaitElementVisiable(_webDriver, _incorrectLoginMessage, 10); return(_webDriver.FindElement(_incorrectLoginMessage).Text); }
public void ChangeName(string newName, string newSurname) { WaitersWrapper.WaitElementInteractable(_webDriver, _nameInputButton, 10); _webDriver.FindElement(_nameInputButton).SendKeys(Keys.Control + "a" + Keys.Backspace); _webDriver.FindElement(_nameInputButton).SendKeys(newName); _webDriver.FindElement(_surnameInputButton).SendKeys(Keys.Control + "a" + Keys.Backspace); _webDriver.FindElement(_surnameInputButton).SendKeys(newSurname); _webDriver.FindElement(_saveButton).Click(); WaitersWrapper.WaitElementAppearDisappear(_webDriver, _confirmationMessage, 10); }
public void SendMessage(string destination, string message) { WaitersWrapper.WaitElementInteractable(_webDriver, _writeButton, 10); _webDriver.FindElement(_writeButton).Click(); WaitersWrapper.WaitElementInteractable(_webDriver, _destinationAddressButton, 10); _webDriver.FindElement(_destinationAddressButton).SendKeys(destination); _webDriver.FindElement(_messageTextButton).SendKeys(message); _webDriver.FindElement(_sendButton).Click(); WaitersWrapper.WaitElementAppearDisappear(_webDriver, _sendConfirmation, 20); }
public GoogleMailMainPageObject Login(string login, string password) { WaitersWrapper.WaitElementInteractable(_webDriver, _loginInputButton, 10); _webDriver.FindElement(_loginInputButton).SendKeys(login); _webDriver.FindElement(_enterButton).Click(); WaitersWrapper.WaitElementInteractable(_webDriver, _passwordInputButton, 10); _webDriver.FindElement(_passwordInputButton).SendKeys(password); _webDriver.FindElement(_enterButton).Click(); return(new GoogleMailMainPageObject(_webDriver)); }
public YopMailMessagePageObject OpenLatestMessage() { WaitersWrapper.Wait(5); try { WaitersWrapper.WaitElementInteractable(_refreshButton); _webDriver.FindElement(_refreshButton).Click(); LoggerWrapper.LogInfo("Refresh button was pushed!"); } catch { LoggerWrapper.LogError("Refresh button: unable to push."); throw; } WaitersWrapper.Wait(5); try { WaitersWrapper.WaitElementInteractable(_frame); IWebElement frame = _webDriver.FindElement(_frame); _webDriver.SwitchTo().Frame(frame); } catch { LoggerWrapper.LogError("Frame wasn't found or XPath (or CSSSelector) is incorrect."); throw; } try { WaitersWrapper.WaitElementInteractable(_latestMessage); _webDriver.FindElement(_latestMessage).Click(); LoggerWrapper.LogInfo("Latest message was opened!"); } catch { LoggerWrapper.LogError("Latest message: unable to open."); throw; } try { _webDriver.SwitchTo().Window(_webDriver.WindowHandles.First()); LoggerWrapper.LogInfo("Browser tab was switched!"); } catch { LoggerWrapper.LogError("Browser tab wasn't switched."); throw; } return(new YopMailMessagePageObject(_webDriver)); }
public string GetPrice() { try { WaitersWrapper.WaitElementVisiable(_totalEstimatedCostLabel); string totalEstimatedCostLabel = _webDriver.FindElement(_totalEstimatedCostLabel).Text; var labelParts = totalEstimatedCostLabel.Split(' '); LoggerWrapper.LogInfo("Pricing label was successfully parsed!"); return(labelParts[4]); } catch { LoggerWrapper.LogError("Pricing label wasn't parsed."); throw; } }
public GoogleCloudPricingCalculatorPageObject ClickTheSearchedLink(string keyWord) { _searchedLink = By.XPath($"//a[contains(text(), '{keyWord}')]"); try { WaitersWrapper.WaitElementInteractable(_searchedLink); _webDriver.FindElement(_searchedLink).Click(); LoggerWrapper.LogInfo($"Searched element ({keyWord}) was found!"); } catch { LoggerWrapper.LogError($"Searched element ({keyWord}) wasn't found or XPath (or CSSSelector) is incorrect."); throw; } return(new GoogleCloudPricingCalculatorPageObject(_webDriver)); }
public SearchResultsPageObject Search(string serviceToSearch) { try { WaitersWrapper.WaitElementInteractable(_searchButton); _webDriver.FindElement(_searchButton).Click(); _webDriver.FindElement(_searchButton).SendKeys(serviceToSearch + Keys.Enter); LoggerWrapper.LogInfo("Search button was pushed!"); } catch { LoggerWrapper.LogError("Search button: unable to push."); throw; } return(new SearchResultsPageObject(_webDriver)); }
public void SetUp() { SetConfiguration(); TestWrapper(() => { _webDriver = DriverSingleton.GetInstance(); _webDriver.Manage().Window.Maximize(); try { _webDriver.Navigate().GoToUrl(_mailServiceAddress); LoggerWrapper.LogInfo("E-Mail generator page was successfully opened!"); } catch { LoggerWrapper.LogError("E-Mail generator page wasn't opened."); throw; } try { IJavaScriptExecutor js = (IJavaScriptExecutor)_webDriver; js.ExecuteScript("window.open();"); LoggerWrapper.LogInfo("The new tab in browser was successfully opened!"); } catch { LoggerWrapper.LogError("The new tab in browser wasn't opened."); throw; } try { _webDriver.SwitchTo().Window(_webDriver.WindowHandles.Last()); _webDriver.Navigate().GoToUrl(_cloudServiceAddress); LoggerWrapper.LogInfo("Cloud service page was successfully opened!"); } catch { LoggerWrapper.LogError("Cloud service page wasn't opened."); throw; } }); WaitersWrapper.SetWaiter(_webDriver, TestContext.Parameters["WaitingTime"]); }
public MailRuMessagePageObject OpenMessage() { WaitersWrapper.WaitElementInteractable(_webDriver, _openLatestMessageButton, 10); _webDriver.FindElement(_openLatestMessageButton).Click(); return(new MailRuMessagePageObject(_webDriver)); }
public EmailYourEstimateLoginPageObject SetParametersOfVM(VirtualMachine virtualMachine) { _chooseVMSeriesType = By.XPath($"//div[contains(text(), '{virtualMachine.VMSerial}')]"); _chooseMachineType = By.XPath($"//div[contains(text(), '{virtualMachine.VMType}')]"); _chooseNumberOfGPUs = By.XPath($"//div[@id='select_container_432']/descendant::div[contains(text(), '{virtualMachine.NumberOfGPUs}')]"); _chooseGPUType = By.XPath($"//div[contains(text(), '{virtualMachine.GPUType}')]"); _chooseSSDVolume = By.XPath($"//div[contains(text(), '{virtualMachine.VMVolume}')]/parent::md-option[@ng-repeat='item in listingCtrl.dynamicSsd.computeServer']"); _chooseRegion = By.XPath($"//div[@id='select_container_97']/descendant::div[contains(text(), '{virtualMachine.Region}')]"); _chooseCommitedUsage = By.XPath($"//div[@id='select_container_104']/descendant::div[contains(text(), '{virtualMachine.CommitedUsage}')]"); try { WaitersWrapper.WaitElementInteractable(_outerFrame); IWebElement outerFrame = _webDriver.FindElement(_outerFrame); _webDriver.SwitchTo().Frame(outerFrame); IWebElement innerFrame = _webDriver.FindElement(_innerFrame); _webDriver.SwitchTo().Frame(innerFrame); } catch { LoggerWrapper.LogError("Frame wasn't found or XPath (or CSSSelector) is incorrect."); throw; } try { WaitersWrapper.WaitElementInteractable(_numberOfInstancesInput); _webDriver.FindElement(_numberOfInstancesInput).Click(); _webDriver.FindElement(_numberOfInstancesInput).SendKeys(virtualMachine.NumberOfInstances.ToString()); LoggerWrapper.LogInfo("Number of instances field was filled!"); } catch { LoggerWrapper.LogError("Number of instances field: unable to fill."); throw; } SelectAndChooseOneFromTable(_selectVMSeriesType, _chooseVMSeriesType, "VMSeries"); SelectAndChooseOneFromTable(_selectMachineType, _chooseMachineType, "Machine type"); try { WaitersWrapper.WaitElementInteractable(_addGPUsCheckbox); _webDriver.FindElement(_addGPUsCheckbox).Click(); LoggerWrapper.LogInfo("Add GPU checkbox was checked!"); } catch { LoggerWrapper.LogError("Add GPU checkbox: unable to check."); throw; } SelectAndChooseOneFromTable(_selectNumberOfGPUs, _chooseNumberOfGPUs, "Number of GPUs"); SelectAndChooseOneFromTable(_selectGPUType, _chooseGPUType, "GPU Type"); SelectAndChooseOneFromTable(_selectSSDVolume, _chooseSSDVolume, "SSD Volume"); SelectAndChooseOneFromTable(_selectRegion, _chooseRegion, "Region"); SelectAndChooseOneFromTable(_selectCommitedUsage, _chooseCommitedUsage, "Commited usage"); try { WaitersWrapper.WaitElementInteractable(_addToEstimateButton); _webDriver.FindElement(_addToEstimateButton).Click(); LoggerWrapper.LogInfo("Add to estimate button was pushed!"); } catch { LoggerWrapper.LogError("Add to estimate button: unable to push."); throw; } try { WaitersWrapper.WaitElementInteractable(_emailEstimateButton); _webDriver.FindElement(_emailEstimateButton).Click(); LoggerWrapper.LogInfo("Email estimate button was pushed!"); } catch { LoggerWrapper.LogError("Email estimate button: unable to push."); throw; } return(new EmailYourEstimateLoginPageObject(_webDriver)); }
public void GoToAccountInfo() { WaitersWrapper.WaitElementInteractable(_webDriver, _accountInfoButton, 10); _webDriver.FindElement(_accountInfoButton).Click(); }
public string GetSenderName() { WaitersWrapper.WaitElementVisiable(_webDriver, _senderNameButton, 10); return(_webDriver.FindElement(_senderNameButton).GetAttribute("title")); }
public string GetMessageText() { WaitersWrapper.WaitElementVisiable(_webDriver, _messageText, 10); return(_webDriver.FindElement(_messageText).Text); }
public GoogleAccountPersonalInfoPageObject GoToPersonalInfo() { WaitersWrapper.WaitElementVisiable(_webDriver, _personalInfoButton, 10); _webDriver.FindElement(_personalInfoButton).Click(); return(new GoogleAccountPersonalInfoPageObject(_webDriver)); }
public GoogleAccountNamePageObject GoToGoogleMailNameInfo() { WaitersWrapper.WaitElementInteractable(_webDriver, _nameButton, 10); _webDriver.FindElement(_nameButton).Click(); return(new GoogleAccountNamePageObject(_webDriver)); }
public void WaitUntilMessageRecieved() { WaitersWrapper.WaitElementVisiable(_webDriver, _amountOfIncomingMessages, 10); }
public string GetMessageState() { WaitersWrapper.WaitElementVisiable(_webDriver, _latestMessageState, 10); return(_webDriver.FindElement(_latestMessageState).GetAttribute("title")); }