0

ZKフレームワークを使用して動的アプリをテストする必要があり、Seleniumはさまざまな要素からIDを識別しないため、テキストボックスにテキストを入力したり、リスト内の要素(データベースからの要素)を選択したりできません

私が使用するもの(xpathまたはcssセレクター)は何も機能せず、常に同じエラーが発生します

問題を解決する方法を知っている人はいますか?

Selenium IDE 1.9.0 を使用しています

Netbeans IDE 7.1.1

および Firefox 16.0.2

ありがとう

Html コードは次のとおりです。

button id="zc_subdossierzulButton_8" class="butt z-button-os" style="border-style: solid;border-width: 1px;border-color: #ED0000;" type="button">リチャール

そして、私が試したJavaコードは次のとおりです。

driver.findElement(By.cssSelector("zc_subdossierzulButton_8.butt")); 

働かない

これ:

driver.findElement(By.cssSelector("butt z-button-os")); 

働かない

この:

String cssSelector = "[class='butt z-button-os']"; 
driver.findElement(By.cssSelector(cssSelector)).clear(); 
driver.findElement(By.cssSelector(cssSelector)).sendKeys("c");
4

1 に答える 1

0

次のドキュメントに目を通し、次のようなさまざまなオプションを使用してみてください

driver.findElement(By.id("coolestWidgetEvah"));
OR
driver.findElements(By.className("cheese"));
OR
driver.findElement(By.tagName("iframe"));
OR
driver.findElement(By.name("cheese"));
OR
driver.findElement(By.linkText("cheese"));
OR
driver.findElement(By.partialLinkText("cheese"));
OR
driver.findElements(By.xpath("//input"));

http://seleniumhq.org/docs/03_webdriver.html#locating-ui-elements-webelements

于 2012-11-22T11:41:16.597 に答える