このHTMLと対話する際に問題が発生しています。私はポップアップを開いて、別のSelenium Webdriverコマンドを使って閉じることができません。私はここで具体的な解決策を探していますが、Angular JSを扱う際の一般的なヒントもありがとうと思います。この問題の根本的な原因は、Selenium Webdriverを使ってAngularを自動化する良い方法がわからないということです。Selenium Webdriverを使用してAngular JSのテストを自動化する方法
私はC#を使用していますが、私はいつでもソリューションを改造することができるため、プログラミング言語から役立つ情報を取ります。 UIB-ポップオーバー・テンプレート= " '/アプリ/学生/評価/ディレクティブ/テンプレート/ 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>
ここで
は私が失敗した試みたものです:
//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);
私はタブ移動になる必要がありました私が望む要素を見つけるためにUIを通して。私は本当にそのような脆弱な解決策に不満であり、あなたがいくつかのアドバイスを提供できることを期待していました。
ありがとうございます!