LoginSignup
1
0

More than 5 years have passed since last update.

contenteditable=trueなエレメントにテキスト入力

Posted at

contenteditable=trueなエレメントにテキスト入力する

ScalatestのSelenium DSLの練習に
Twitterに適当なツイートしてみるコード書いてみてわかったのだが。

SeleniumのWebDriverでcontenteditableなエレメントに何か入力するには
1回クリックする必要があるらしい。


// tweet-box-home-timelineはcontenteditable=trueなdiv
val tweetbox = find("tweet-box-home-timeline").get

// 1度クリックしないと入力できない
click on tweetbox

// ↓これは動かない。TextBoxじゃないからダメです的なエラーになる。
//enter(tweet)

// 代わりにunderlyingでscalatestのElementからseleniumのWebElementにして、sendKeysする
tweetbox.underlying.sendKeys(tweet)

gistにコード全文。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0