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.
I'm using C#, but I will take any helpful information from any programming language as I can always retrofit the solution.
I am trying to interact with this pop up button, unsuccessfully: uib-popover-template="'/app/student/assessment/directives/templates/shortTextPopupTemplate.html'"
<div class="line ttsBorder">“<span style="font-style:italic;">And be it further enacted</span><span style="display: inline;">, That in all that territory ceded</span><span short-text-popup="" accession-number="VH209006" class="ng-isolate-scope" ng-non-bindable=""><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;"></a></span> by France to the United States . . . which lies north of thirty‑six degrees and thirty minutes north latitude . . . slavery . . . shall be, and is hereby, forever prohibited.”</div>
Here is what I tried unsuccessfully:
//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);
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.
Thanks in advance!