Skip to content

Commit

Permalink
Code reduction and removal of unnecessary library
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostUNK authored Nov 6, 2024
1 parent 8cbcfa2 commit f45514f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Email.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.ObjectModel;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;

// Email client code
public class EmailHandler
Expand All @@ -19,8 +16,7 @@ public string GetFakeEmailAddress()
_driver.Navigate().GoToUrl("https://fakemail.net");

// Receiving email
var emailElement = WaitH.WaitUntilElementClickable(_driver, By.Id("email"));
string emailAddress = emailElement.Text;
string emailAddress = WaitH.WaitUntilElementClickable(_driver, By.Id("email")).Text;

return emailAddress;
}
Expand All @@ -45,9 +41,8 @@ public void ConfirmEmail()
// Switch to iframe
_driver.SwitchTo().Frame("iframeMail");

// Wait until the “Confirm registration” button becomes available
var confirmButtonElement = WaitH.WaitUntilElementClickable(_driver, By.XPath("//a[contains(text(), 'Confirm registration')]"));
confirmButtonElement.Click();
// Wait until the “Confirm registration” button becomes available
WaitH.WaitUntilElementClickable(_driver, By.XPath("//a[contains(text(), 'Confirm registration')]")).Click();

// Switch to a new tab
_driver.SwitchTo().Window(_driver.WindowHandles[1]);
Expand Down

0 comments on commit f45514f

Please sign in to comment.