Failure Sharing

Bootup your energy with sharing failure.

Selenium

@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…

要素が隠れていて、クリックのテストケースができない場合

問題 要素がnot visibleになっていて、クリック動作が動かなかった→テスト失敗 どこが問題なのか CSS選択ができない XPathも使えない 原因 単に当たる要素が見える化されてないから。 解決策 クリックをする前に、コードレベルでJSとして値をVisibleに変換す…

Selenium WebDriver:はじめ

タスク解決のために、webdriverの勉強をし始めます。 Automation Testing Building a test framework Manage regression testing and functional testing Continuous integration / development Behavior-Driven Development with Cucumber Selenium Suite T…