模拟用户浏览多页搜索结果

时间:2012-07-06 15:36:23

标签: watir-webdriver

我需要通过在watir中运行多个页面的多个搜索结果来模拟用户搜索。所以我要说我搜索一个产品&我得到35个搜索结果(每页10个搜索结果),我需要点击查看该产品,进入详细的产品页面&回到搜索页面。

我们正在开发的这个网站与linkedin非常相似,所以我在这里附上了一个linkedin html。挑战是我需要在html中识别类似于下面https://linkedin.com/view=1324526的模式? ...现在因为有很多链接,我如何识别这个特定模式并点击产品/配置文件。此外,一旦我到达个人资料,我如何回到搜索结果..请注意,在linkedin之间有很多巧合,所以我以链接为例。我可以轻松修改脚本,如果它类似于linkedin。感谢

</li>
<li class="vcard expanded-view " id="vcard-8">
<div class="result-data">
<div class="actions">
<a href="http://www.linkedin.com/people/invite?from=profile&amp;key=39198881&amp;firstName=Sharon&amp;lastName=Monteiro&amp;authToken=MrLR&amp;authType=OUT_OF_NETWORK&amp;pvs=ps&amp;trk=pp_invite_member_action&amp;goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2" class="primary-action trk-invite-member connecticon" name="_inviteLink"><strong>Connect</strong></a>
<div class="dropdown action-dropdown">
<h3>See all results &#187;</h3>
<ul class="drop action-dropdown-list">
<li>
<a href="/requestList?destID=39198881&amp;creationType=REFERRAL&amp;displayProposal=&amp;pvs=ps&amp;trk=pp_get_intro_action&amp;goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2" class="external-link trk-get-intro" name="_getIntroducedLink"> Get introduced </a>
</li>
<li>
<a href="/requestList?destID=39198881&amp;creationType=DC&amp;displayProposal=&amp;pvs=ps&amp;authToken=MrLR&amp;authType=OUT_OF_NETWORK&amp;trk=pp_send_inmail_action&amp;goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2" class="external-link trk-send-inmail" name="_sendInMailLink"> Send InMail </a>
</li>
<li>
<a href="/forwardProfileMsg?displayCreate=&profileID=39198881&profileName=Sharon+Monteiro&network=I&authToken=MrLR&authType=OUT_OF_NETWORK&trk=pp_share_profile_action" class="external-link trk-share-profile" name="_shareProfileLink"> Share Profile </a>
</li>
<li class="one-click">
<a href="#" class="trk-find-references" name="vcard-8">Find references</a>
</li>
</ul>
</div>
</div>
<a href="/profile/view?id=39198881&authType=OUT_OF_NETWORK&authToken=MrLR&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=9&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps&trk=pp_profile_photo_link" class="profile-photo external-link trk-profile-photo" target="_top" tracking="hb_upphoto" data-li-larger-profile="http://media01.linkedin.com/media/p/2/000/053/26a/23e1360.jpg">
<img src="http://media03.linkedin.com/mpr/mpr/shrink_60_60/p/2/000/053/26a/23e1360.jpg" class="photo" alt="Sharon Monteiro" width="60" height="60">
<span class="larger-profile-photo-control"></span>
</a>
<h2>
<a href="/profile/view?id=39198881&authType=OUT_OF_NETWORK&authToken=MrLR&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=9&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps&trk=pp_profile_name_link" class="fn n external-link trk-profile-name" title="View Profile" target="_top">
Sharon Monteiro
</a>
<span class="badges">
<abbr title="Sharon Monteiro is a 2nd degree contact"><span class="network-degree">2<sup>nd</sup></span></abbr>
</span>
<span class="saved-profile">
<a href="/organizer?trk=subpro_goto_srch" >Saved</a>
</span>
</h2>
<a href="/profile/view?id=39198881&authType=OUT_OF_NETWORK&authToken=MrLR&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=9&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps" class="url">View Profile</a>
<dl class="vcard-basic">
<dt>Title</dt>
<dd class="title">Life Coach whose specializes in transforming people's lives with NLP, Theta Healing, Coaching, EFT,</dd>
<dt class="demographic-info">Demographic info</dt>
<dd class="location-industry">
<span class="location">
United Arab Emirates
</span>
<span class="separator">&#183;</span>
<span class="industry">
Think Tanks
</span>
</dd>
<dt class="network-information">Network Information</dt>
<dd class="connections-recommendations">
91 connections
<span class="separator">&#183;</span>
1 recommendation
</dd>
</dl>
<dl class="vcard-expanded">
<dt class="current">Current:</dt>
<dd class="show-less-text">
<span class="current-details less-text">Educator, Trainer, Speaker, Writer ... <span class="toggle-show-more">more</span></span>
<span class="current-details more-text">Educator, Trainer, Speaker, Writer at Releasing With Love <span class="toggle-show-less">less</span></span>
</dd>
<dt class="past">Past:</dt>
<dd class="show-less-text">
<span class="past-details less-text">Head <strong class="highlight">Instructor</strong> at Releasing With ... <span class="toggle-show-more">more</span></span>
<span class="past-details more-text">Head <strong class="highlight">Instructor</strong> at Releasing With Love <span class="toggle-show-less">less</span></span>
</dd>
<dt class="incommon-connections">In Common:</dt>
<dd>
<span>
<a href="/profile/view?id=39198881&authType=OUT_OF_NETWORK&authToken=MrLR&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=9&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps&trk=pp_shared_conn_link" name="vcard-8" class="toggle-shared-connections trk-shared-conn-link trk-no-external" title="View your shared connections"> <strong>1</strong> shared connection</a>
<span class="separator">&#183;</span>
<a title="View similar people" target="_top" class="similar trk-similar" href="/search/fpsearch?viewType=sim&sId=39198881&trk=psearch_similar">Similar</a>
</span>
</dd>
</dl>
<div class="shared-connections">
<h3>Shared Connections</h3>
<div class="progress-indicator"><img src="http://static01.linkedin.com/scds/common/u/img/anim/anim_loading_16x16.gif" width="16" height="16" alt="Loading"></div>
<ul>
</ul>
<p class="error-msg">
<span class="error">There was an error loading your shared connections. Refresh the page and try again.</span>
</p>
</div>
</div>
</li>
<li class="vcard expanded-view " id="vcard-9">
<div class="result-data">
<div class="actions">
<a href="/requestList?destID=82828415&amp;creationType=DC&amp;displayProposal=&amp;pvs=ps&amp;authToken=uja0&amp;authType=OUT_OF_NETWORK&amp;trk=pp_send_inmail_action&amp;goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2" class="primary-action trk-send-inmail messageicon" name="_sendInMailLink"><strong>Send InMail</strong></a>
<div class="dropdown action-dropdown">
<h3>See all results &#187;</h3>
<ul class="drop action-dropdown-list">
<li>
<a href="/requestList?destID=82828415&amp;creationType=REFERRAL&amp;displayProposal=&amp;pvs=ps&amp;trk=pp_get_intro_action&amp;goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2" class="external-link trk-get-intro" name="_getIntroducedLink"> Get introduced </a>
</li>
<li>
<a href="/forwardProfileMsg?displayCreate=&profileID=82828415&profileName=Phillip+E%2E+G%2E&network=I&authToken=uja0&authType=OUT_OF_NETWORK&trk=pp_share_profile_action" class="external-link trk-share-profile" name="_shareProfileLink"> Share Profile </a>
</li>
<li class="one-click">
<a href="#" class="trk-find-references" name="vcard-9">Find references</a>
</li>
</ul>
</div>
</div>
<a href="/profile/view?id=82828415&authType=OUT_OF_NETWORK&authToken=uja0&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=10&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps&trk=pp_profile_photo_link" class="profile-photo external-link trk-profile-photo" target="_top" tracking="hb_upphoto" data-li-larger-profile="http://media03.linkedin.com/media/p/2/000/068/3b8/1a0b9bf.jpg">
<img src="http://media02.linkedin.com/mpr/mpr/shrink_60_60/p/2/000/068/3b8/1a0b9bf.jpg" class="photo" alt="Phillip E. G." width="60" height="60">
<span class="larger-profile-photo-control"></span>
</a>
<h2>
<a href="/profile/view?id=82828415&authType=OUT_OF_NETWORK&authToken=uja0&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=10&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps&trk=pp_profile_name_link" class="fn n external-link trk-profile-name" title="View Profile" target="_top">
Phillip E. G.
</a>
<span class="badges">
<abbr title="Phillip E. G. is a 3rd degree contact"><span class="network-degree">3<sup>rd</sup></span></abbr>
</span>
<span class="saved-profile">
<a href="/organizer?trk=subpro_goto_srch" >Saved</a>
</span>
</h2>
<a href="/profile/view?id=82828415&authType=OUT_OF_NETWORK&authToken=uja0&locale=en_US&srchid=26e4d6f3-1ee3-436f-b006-395fded1f576-0&srchindex=10&srchtotal=1317249&goback=%2Efps_PBCK_instructor_*1_*1_*1_*1_*1_*1_*2_*1_Y_*1_*1_*1_false_1_R_*1_*51_*1_*51_true_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2_*2&pvs=ps" class="url">View Profile</a>
<dl class="vcard-basic">
<dt>Title</dt>
<dd class="title">Director of Training - Clark County Dive Rescue Team</dd>
<dt class="demographic-info">Demographic info</dt>
<dd class="location-industry">
<span class="location">
Portland, Oregon Area
</span>
<span class="separator">&#183;</span>
<span class="industry">
Public Safety
</span>
</dd>
<dt class="network-information">Network Information</dt>
<dd class="connections-recommendations">
500+ connections
<span class="separator">&#183;</span>
1 recommendation
</dd>
</dl>
<dl class="vcard-expanded">
<dt class="current">Current:</dt>
<dd class="show-less-text">

1 个答案:

答案 0 :(得分:0)

根据我的理解,您需要做的就是使用浏览器中的后退按钮。

    @browser.back
相关问题