0
我想從下面的HTML中提取數據消息的ID。我最初的目標是提取包含特定文本的跨度的數據消息ID,然後單擊star_button以對其進行標記。Python的硒get_attribute不返回值
<div class="message_content_header">
<div class="message_content_header_left">
<a href="/team/krishnag0902" target="/team/krishnag0902" class="message_sender color_U5TPDSMQQ color_9f69e7 member member_preview_link " data-member-id="U5TPDSMQQ">krishnag0902</a>
<span class="ts_tip_float message_current_status ts_tip ts_tip_top ts_tip_multiline ts_tip_delay_150 color_U5TPDSMQQ color_9f69e7 hidden ts_tip_hidden">
<span class="ts_tip_tip ts_tip_inner_current_status">
<span class="ts_tip_multiline_inner">
</span>
</span>
</span>
<a href="/archives/C5UGEFBS9/p1498084447119862" target="new_1498118826460" class="timestamp ts_tip ts_tip_top ts_tip_float ts_tip_hidden ts_tip_multiline ts_tip_delay_300"><i class="copy_only">[</i>4:34 PM<i class="copy_only">]</i><span class="ts_tip_tip"><span class="ts_tip_multiline_inner">Yesterday at 4:34:07 PM</span></span></a>
<span class="message_star_holder">
星此消息
</div>
</div>
<span class="message_body">hoho<span class="constrain_triple_clicks"></span></span>
<div class="rxn_panel rxns_key_message-1498084447_119862-C5UGEFBS9"></div>
<i class="copy_only"><br></i>
<span id="msg_1498084447_119862_label" class="message_aria_label hidden">
<strong>krishnag0902</strong>.
hoho.
four thirty-four PM.
</span>
和我使用上述跨度(message_star_holder),該函數返回一個無
data_mess= star_button_span.find_element_by_xpath("//button[@class=
'star ts_icon ts_icon_star_o ts_icon_inherit ts_tip_top star_message
ts_tip ts_tip_float ts_tip_hidden btn_unstyle']")
print data_mess.get_attribute("innerHTML")
print star_button_span.get_attribute("data-msg-id")
@KrishnaGaurav我可以從以前的問題,看到的唯一區別是,新的HTML沒有連接到它。這是關於別的東西的問題嗎? – Guy
是的,這是一個單獨的,因爲我開始處理一個不同的html塊,可能有我正在尋找的信息。有沒有辦法直接與您取得聯繫?您的幫助將非常感激。 –
@KrishnaGaurav如果你有一個新的問題,你應該發佈一個新的問題,而不是編輯一箇舊的問題。 – Guy