Failure Sharing

Bootup your energy with sharing failure.

2018-09-17から1日間の記事一覧

@FindByを使って、簡単にWebElementをセットする。

FindByアノテーションを使うことで、こんな長いコードが public void setUserName(String username) { driver.findElement(By.id("MainContent_txtUserName")).sendKeys(username); } public void setPassword(String password) { driver.findElement(By.id(…

ウィンドウを移動して操作する。(POPUP or New Window)

例えば、こういうふうに複数のウィンドウがあるとしたら、 操作のためにポインターを移動させる必要がある。 こういう場合は、現在開いているウィンドウ情報を持ってきて(リスト)、 その中でポインターをSwitchさせたらオッケー Code // Switch the window…

Advanced XPath

ロードに時間がかかる時とかの解決策ってことかな。 //driver.findElement(By.xpath("//*[@id=\"40553\"]/div[2]/div/a")).click(); driver.findElement(By.xpath("//*[@id=\"resultsContainer\"]/section/article[" + searchResult + "]/div[2]/div/a")).cl…

要素が存在してるにもかかわらず、NoSuchElementException

問題 要素をクリックしようとした時、次のエラーが出ることがある。 org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="hotelResultTitle"]/h1"} 理由 理由としてはまさに、…