public void AddNotification(string activityName, string toProperty, string subjectLine) { Trace.WriteLine(String.Format("Attempting to add notification with ToProperty: {0} to activity: {1} with subjectLine: '{2}'", toProperty, activityName, subjectLine)); var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[3]/img[1]")); imageLink.Click(); var popup = new ActivityNotificationPopup(); popup.SwitchTo(); popup.AddNotification(toProperty, subjectLine); popup.BtnOk.Click(); popup.SwitchBackToParent(); }