【Selenium】真下の兄弟要素を取得する

dt要素の真下のddを取りたいことありますよね~

dtの真下のddを取得

dd = dt.find_element("xpath", "following-sibling::dd[1]")

dtの真下のddを全て取得

ddが複数あるばあに次のdtまでのddをすべて取得します。

dds = dt.find_elements("xpath", "following-sibling::*[self::dd and not(preceding-sibling::dt[1] != current())]")

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です