Contents
指定されたリンクテキストに一致する最初のWebElement オブジェクトを取得します。
- 構文
- WebElement = WebDriver.FindElementByLinkText( linktext, timeout, raise )
- 引数
- linktext (String)必須
- 取得する要素のリンクテキスト
- timeout (Long = -1)省略可
- タイムアウト(単位:ms)。raiseにTrueが指定されている場合、時間が過ぎるとエラーが発生します。
- raise (Boolean = True)省略可
- Trueのとき、タイムアウト経過後に例外を発生させる。
- 戻り値
使い方
リンクテキストがログインに一致する最初の要素をクリックします。まずクリックする要素のWebElement オブジェクトを取得し、WebDriver.FindElementByLinkText メソッドでその要素をクリックします。
DIM WebElement = WebDriver.FindElementByLinkText("ログイン")
WebElement.Click()
Chromeでhttp://example.comを開き、リンクテキストがMore information...に一致する最初の要素をクリックします。
DIM WebDriver = CREATEOLEOBJ("Selenium.WebDriver")
WITH WebDriver
.Start("chrome")
.Get("http://example.com")
DIM WebElement = .FindElementByLinkText("More information...")
WebElement.Click()
SLEEP(5.000)
ENDWITH
<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>
この記事は役に立ちましたか?
ご協力ありがとうございます。