I have the following html code on the page received by mechanize (agent.get):
<div class="b-resumehistorylist-views">
<!-- first date start-->
<div class="b-resumehistory-date">date1</div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time1</div>
<a href="company_lynk1">company1</a></div>
<!-- second date start -->
<div class="b-resumehistory-date">date2</div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time2</div>
<a href="company_lynk2">company2</a>
</div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time3</div>
<a href="company_lynk3">company3</a></div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time4</div>
<a href="company_lynk4">company4</a></div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time5</div>
<a href="company_lynk5">company5</a></div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time6</div>
<a href="company_lynk6">company6</a></div>
<div class="b-resumehistory-company">
<div class="b-resumehistory-time">time7</div>
<a href="company_lynk7">company7</a></div>
...
</div>
I need to search inside the div with class=”b-resumehistorylist-views” each date.
Then find all divs between two div-dates and link each item to this particular date.
The problem is that each item (div class = b-resumehistorylist-views) is not inside div=b-resumehistorylist-views.
At final stage I need to receive the following array:
array = [ [date1, time1, company1, companylink1], [date2, time2, company2, companylink2], [date2, time3, company3, companylink3],[date2, time4, company4, companylink4] ]
I know that I must use method search with text() option, but I cannot find the solution.
My code right now can parse all companies information between div class=b-resumehistory-company, but I need to find right date.
It would be the same thing as before, just some of the class attributes have been changed: