page#title returns empty string if no title tag

master
Kanezoh 2021-06-11 08:45:14 +09:00
parent e3f6aa26ba
commit 29a0969504
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,12 @@ class MechanizeCr::Page < MechanizeCr::File
end end
def title def title
title = parser.css("title").first.inner_text title_node = css("title")
if title_node.empty?
""
else
title_node.first.inner_text
end
end end
def forms def forms