私たちは、このようなダッシュボードページのオフウィジェットを呼び出すオブジェクトをすべてクリアするでしょう明確なダッシュボードのステップを記述しようとしている:Selenium Chromeドライバがスクロールバー以下の要素を検出できないのはなぜですか?
public static void ClearDashboard(string widgetToKeep = null)
{
var widgets = Driver.FindElements(
By.XPath(
$"//div[@widget-name and descendant::span[@class='title' and text()[not(contains(., '{widgetToKeep ?? "dummyText"}'))]]]"
));
if (widgets != null)
{
foreach (IWebElement widget in widgets)
{
var closeButton = widget.FindElement(By.XPath(".//span[@class='delete']"));
closeButton.Click();
}
}
それは完全に動作します。 それはタイトルに戻ってすべてのスパンの要素を取得し、私は、これらの要素によってロールスパンがそれぞれのボタンを削除し得る、としてウィジェットを削除することができます。少しオフになっているウィジェットオブジェクトを除き
closeButton.Click()
画面の ウィジェットが少し画面外にある場合、スパンボタンを見つけることができないようです。
This is the exception: InvalidOperation was unhandled by user code
An exception of type 'System.InvalidOperationException' occurred in WebDriver.dll but was not handled in user code
Additional information: unknown error: Element is not clickable at point (951, 760). Other element would receive the click:
<div class="scroll" ng-class="{'getting-data': gettingNewData}" scroll-pag="">...</div>
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.1.7601 SP1 x86_64)
いいえ、あなたはいけません。 WebDriverは、「要素を暗黙的にスクロールして表示する」という仕様で自動的にこれを行うことになっています。©https://www.w3.org/TR/webdriver/#element-interaction –