以下代码完美地将对话导出到收件箱。但是,由于收件箱是基于网络的,因此dropdown = browser.find_element_by_id("dnn_ctr1009_USDMservice_CompStats_2017_aoiType_chosen")
dropdown.click()
search = dropdown.find_element_by_tag_name("input")
search.send_keys("county", Keys.ENTER)
字段包含原始HTML标记;
Message
我尝试在<div>
Hello,<br><br>
I had my profile switched
</div>
和strip_tags
的末尾使用threaded_conversation.threads.last.body
,但无济于事。是否有正确的方法将此字符串保留为仅文本?
customer_message
答案 0 :(得分:2)
使用正确的HTML库:
require 'nokogiri'
text = Nokogiri::HTML(body).text
# => "\nHello,\nI had my profile switched\n\n"