title: How to automate testing of Angular JS using Selenium Webdriver
body: <p>So I am facing a problem interacting with this HTML below. I am unable to open the pop up and close it using different Selenium Webdriver commands. Although I am looking for a specific solution here, any general tips on dealing with Angular JS would also be appreciated. I believe that the root cause of the problem is that I do not know a good way to automate Angular using Selenium Webdriver.</p>
  
  <p>I'm using C#, but I will take any helpful information from any programming language as I can always retrofit the solution.</p>
  
  <p>I am trying to interact with this pop up button, unsuccessfully:
  uib-popover-template="'/app/student/assessment/directives/templates/shortTextPopupTemplate.html'"</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="line ttsBorder"&gt;“&lt;span style="font-style:italic;"&gt;And be it further enacted&lt;/span&gt;&lt;span style="display: inline;"&gt;, That in all that territory ceded&lt;/span&gt;&lt;span short-text-popup="" accession-number="VH209006" class="ng-isolate-scope" ng-non-bindable=""&gt;&lt;a uib-popover-template="'/app/student/assessment/directives/templates/shortTextPopupTemplate.html'" popover-is-open="ctrl.isVisible" popover-trigger="none" popover-placement="auto top" tabindex="0" title="Shows more information." ng-click="buttonOnClick($event)" ng-keydown="buttonOnKeydown($event)" ng-class="['stpu-button', {disabled: ctrl.isDisabled, active: ctrl.isVisible}]" class="ng-scope stpu-button" style="z-index: 3;"&gt;&lt;/a&gt;&lt;/span&gt; by France to the United States&amp;nbsp;.&amp;nbsp;.&amp;nbsp;.&amp;nbsp;which lies north of thirty‑six degrees and thirty minutes north latitude&amp;nbsp;.&amp;nbsp;.&amp;nbsp;.&amp;nbsp;slavery&amp;nbsp;.&amp;nbsp;.&amp;nbsp;.&amp;nbsp;shall be, and is hereby, forever prohibited.”&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is what I tried unsuccessfully:</p>
  
  <pre><code>//attempt 1
  var elements = Driver.FindElements(By.XPath("//*[@class='line ttsBorder']"));
  
  //attempt 2 - UserInteractions = new Actions(Driver);
  UserInteractions.MoveToElement(PopUpButton).Click().Perform();
  
  
  //attempt 3    
      Driver.FindElement(By.XPath("//[@title='Shows more information.']")).Click();
  
  //attempt 4
  //Driver.FindElement(By.XPath("//a[@uib-popover-template]"));
      PopUpButton.Click();
  
  //attempt 5
  //Working, but seems dirty - JavaExecutor.ExecuteScript("arguments[0].click();", PopUpButton);
  </code></pre>
  
  <p>I had to result to tabbing through the UI to find the element that I want. I'm really unhappy with such a brittle solution and was hoping that you can offer some advice.</p>
  
  <p>Thanks in advance!</p>