LoginSignup
0
0

More than 3 years have passed since last update.

nicEdit 入力欄への書き込み

Posted at

軽い備忘録。

ゆえあってウェブアプリケーション内の textarea に自動書き込みをすることになった。ところがこいつは真正の textarea ではなく nicEdit でリッチテキストを入力できる textarea もどきだった。件の場所のソースはこうなっている。

<div style="..." class=" nicEdit-main  " contenteditable="true"><br></div>

とりあえず driver.find_element_by_xpath(...).innerHTML = "..." としてみたがスルーされてしまう。

インスペクターを表示させて実際に入力してみると、

<div style="..." class=" nicEdit-main nicEdit-selected " contenteditable="true"><br></div>

と変化していた。一度クリックすると入力受付状態へ遷移するらしい。

今回は次の手順で書き込むことができた。

driver.find_element_by_xpath('//div[contains(@class, "nicEdit-main")]').click()
driver.find_element_by_xpath('//div[contains(@class, "nicEdit-main nicEdit-selected")]').send_keys(...)
0
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
0
0