void ActivateKey(string key) { logger.Info( MyOperation.KeyActivation, OperationStatus.Started, new LogInfo(MyLogInfoKey.KeyCode, key)); By keyInputSelector = By.Id("product_key"); By keyActivationButtonSelector = By.Id("register_btn"); By agreementCheckboxSelector = By.Id("accept_ssa"); By errorSelector = By.Id("error_display"); By receiptSelector = By.Id("receipt_form"); By productNameSelector = By.ClassName("registerkey_lineitem"); if (!webProcessor.IsElementVisible(keyInputSelector)) { webProcessor.GoToUrl(KeyActivationUrl); } webProcessor.SetText(keyInputSelector, key); webProcessor.UpdateCheckbox(agreementCheckboxSelector, true); webProcessor.Click(keyActivationButtonSelector); webProcessor.WaitForAnyElementToBeVisible(errorSelector, receiptSelector); if (webProcessor.IsElementVisible(errorSelector)) { string errorMessage = webProcessor.GetText(errorSelector); HandleActivationError(key, errorMessage); return; } string productName = webProcessor.GetText(productNameSelector); keyHandler.MarkKeyAsActivated(key, productName); logger.Debug( MyOperation.KeyActivation, OperationStatus.Success, new LogInfo(MyLogInfoKey.KeyCode, key)); }