WebElements.Countカウント プロパティ

本ページには広告が含まれています。

WebElementsコレクション内の要素数を返します。

構文
  1. Long = WebElements.Count
引数
戻り値

WebElements オブジェクトを返すメソッド・プロパティ

WebElements.Count プロパティ
指定されたロケータに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたロケータと値に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたCSSクラスに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたCSSセレクタに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたid属性に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたリンクテキストに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたname属性に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたリンクテキストの部分に一致するすべてのWebElements オブジェクトを取得します。
WebDriver.FindElementsByTag メソッド
指定されたタグ名に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定された XPath クエリに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたロケータに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたロケータと値に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたCSSクラスに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたCSSセレクタに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたid属性に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたリンクテキストに一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたname属性に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたリンクテキストの部分に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定されたタグ名に一致するすべてのWebElements オブジェクトを取得します。
WebElements.Count プロパティ
指定された XPath クエリに一致するすべてのWebElements オブジェクトを取得します。

使い方

WebElementsコレクション内の要素数を返します。

UWSC
PRINT WebElements.Count

以下はExample DomainのpタグのWebElements オブジェクトを取得しその要素数を返します。

HTML
<body>
	<div>
		<h1>Example Domain</h1>
		<p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
		<p><a href="https://www.iana.org/domains/example">More information...</a></p>
	</div>
</body>
UWSC
DIM WebDriver = CREATEOLEOBJ("Selenium.WebDriver")
WebDriver.Start("chrome")
WebDriver.Get("https://example.com")

DIM WebElements = WebDriver.FindElementsByTag("p")
PRINT WebElements.Count
結果
プレーンテキスト
2