0

Webdriver 2.25.0 と Firefox 14 を使用しています

次のテキストエリアがあります。

<textarea id="source-text" placeholder="Start typing your text" style="resize: none; overflow: hidden;"></textarea>

このテキスト領域を HomePage オブジェクトで次のように識別しています。

@FindBy(how = How.CSS, using = "div.myclass textarea")
public WebElement columnLeftTextarea;

私がやりたいことは、次のコードを使用して、このテキストエリア内にテキストを入力するだけです

homePage.columnLeftTextarea.sendKeys("some text");

これにより、次のエラーが返されます。

Type mismatch Can't assign non-array value to an array

テキストエリアは、実行時のように正しく定義されています

 homePage.columnLeftTextarea.getAttribute("placeholder")

私は正しいテキストを取得します

機能をネイティブイベントを有効にするように設定して、ブラウザーを起動しようとさえしました。

FirefoxProfile ffProfile = new FirefoxProfile(new File(generalPropertiesTestObject.getFirefox_profile_template_location()));
        ffProfile.setEnableNativeEvents(true);
        FirefoxDriver ffd = new FirefoxDriver(ffProfile);
        capabilities = ffd.getCapabilities();

しかし、それでも同じエラーが発生します。誰かそれについて何か考えがありますか?

4

2 に答える 2

4

最初にテキストエリアに焦点を合わせてみてください。次のコードを使用して実行しました。

 driver.findElement(By.id("source-text")).clear();
 driver.findElement(By.id("source-text")).sendKeys("some text");

そしてそれはうまくいくようです。

于 2012-09-05T13:12:19.327 に答える