是否有一个Ruby工具允许我以(Abbreviated => Abr)的格式加载缩写文件?然后我需要从另一个文件中读取每个单词.如果单词与缩写中的单词匹配,我需要将其更改为缩写单词.我想我可以使用Hash,但我不知道如何从文件中加载它.
如何使用Nokogiri查找文本<!--Sanction 3-->(解析HTML)?
我在网站中输入搜索字词,结果显示在下一页上.如果满足特定条件,我需要以编程方式从结果页面中获取数据.
当我分析结果页面时,我注意到这些项目被分解为制裁.我需要知道制裁是否有数据,如果是,它是否包含我的关键字; 我在找县/州.我不知道如何看待制裁.这里有一点HTML:
<!--Sanction 3-->
<table border="2" cellpadding="2" cellspacing="0" width="100%">
<thead>
<tr>
<th class="XXheaderClass" colspan="5" scope="colgroup">
<table bgcolor="#ff9999" width="100%">
<tbody>
<tr>
<td class="XXsanctionHeader1">
<span class="XXtextBold">Requirements Met</span>
</td>
<td class="XXsanctionHeader2">
<span class="XXtextBold">Status: GOOD</span>
</td>
</tr>
</tbody>
</table>
</th>
</tr>
<tr>
<th class="XXheaderClass" width="31%" scope="col">
<span class="XXsmallTextBold">Description</span>
</th>
<th class="XXheaderClass" width="12%" scope="col">
<span class="XXsmallTextBold">Effective Date</span>
</th>
<th class="XXheaderClass" width="12%" scope="col">
<span class="XXsmallTextBold">Number</span>
</th>
<th class="XXheaderClass" width="12%" scope="col">
<span class="XXsmallTextBold">County/State</span>
</th>
<th class="XXheaderClass" width="33%" scope="col">
<span class="XXsmallTextBold">Address and Phone …Run Code Online (Sandbox Code Playgroud) 您将如何使用Ruby打开网站并在搜索字段中进行搜索,然后解析结果?例如,如果我在搜索引擎中输入内容然后解析结果页面.我知道如何使用Nokogiri找到网页并打开它.我迷失在如何输入搜索字段并前进到结果.另外在我实际搜索的页面上我必须单击输入,我不能简单地按Enter键继续前进.非常感谢你的帮助.