我正在为我们的MLS(多列表系统)系统编写测试脚本。该网站主要使用C#.NET编写。
这是HTML源代码:
> <TABLE style="BORDER-RIGHT-WIDTH: 0px;
> BORDER-TOP-WIDTH: 0px;
> BORDER-BOTTOM-WIDTH: 0px;
> BORDER-LEFT-WIDTH: 0px; CURSOR:
> default" id="uwmMainMenu_MainM"
> onmouseup="javascript:igmenu_mouseup(this,
> event);"
> onselectstart="javascript:igmenu_selectStart();"
> class="WebMenu"
> onmouseover="javascript:igmenu_mouseover(this,
> event);"
> onmouseout="javascript:igmenu_mouseout(this,
> event);"
> onmousedown="javascript:igmenu_mousedown(this,
> event);" border="0" cellSpacing="1"
> cellPadding="2" igLevel="0"
> submenu="1"> <TBODY> <TR> <TD
> accessKey="S"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_1" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_1M"
> igHov="IGMenuItemHover" igTag="1"
> igClass="IGMenuItem"
> igPrevClass="IGMenuItem">
> <U>S</U>earches </TD> <TD
> accessKey="L"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_2" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_2M"
> igHov="IGMenuItemHover" igTag="2"
> igClass="IGMenuItem"> <U>L</U>istings
> </TD> <TD accessKey="T"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_3" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igHov="IGMenuItemHover" igTag="26"
> igFrame="_Script"
> igUrl="menuOneLevelItemClick('http://realist2.firstamres.com/propertylink?UserID=rapstaff&AgentLastName=Staff&AgentFirstName=Rapattoni&CustomerGroupName=Sedona
> Verde
> Valley&UserPW=sedona','_Realist')"
> igClass="IGMenuItem"> <U>T</U>ax </TD>
> <TD accessKey="R"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_4" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igHov="IGMenuItemHover" igTag="3"
> igFrame="_Script"
> igUrl="Cart_OnClick()"
> igClass="IGMenuItem"> Ca<U>r</U>t
> </TD> <TD accessKey="C"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_5" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_5M"
> igHov="IGMenuItemHover" igTag="4"
> igClass="IGMenuItem"> <U>C</U>ontacts
> </TD> <TD accessKey="N"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_6" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_6M"
> igHov="IGMenuItemHover" igTag="5"
> igClass="IGMenuItem"> Li<U>n</U>ks
> </TD> <TD accessKey="A"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_7" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_7M"
> igHov="IGMenuItemHover" igTag="6"
> igClass="IGMenuItem"> <U>A</U>dmin
> </TD> <TD accessKey="H"
> onkeydown="igmenu_kbMD(this,event);"
> id="uwmMainMenu_8" class="IGMenuItem"
> onfocus="igmenu_kbFocus(this,event);"
> onkeyup="igmenu_kbNav(this,event);"
> align="center" igTop="1"
> igChildId="uwmMainMenu_8M"
> igHov="IGMenuItemHover" igTag="7"
> igClass="IGMenuItem"> <U>H</U>elp
> </TD> </TR> </TBODY> </TABLE>
> </DIV></DIV></DIV></DIV></FORM></BODY></HTML>
我尝试在Firefox上使用TestWise Recorder来查看我当前访问的实际元素,但FF无法识别它。 :(
任何人都可以给我一个我错过的提示吗?
谢谢,
答案 0 :(得分:2)
陈 您的问题有很多解决方案 尝试这个,因为它适合我
require 'watir'
test_site = "http://svvarmls.rapmlsqa.com/"
ie = Watir::IE.new
ie.goto test_site
ie.text_field( :id, "txtUserName" ).set "rapstaff"
ie.text_field( :id, "txtPassword" ).set "Succ3ss!"
ie.button( :id, "btnSubmit" ).click
table = ie.table(:id,"uwmMainMenu_MainM")
table[1][1].fire_event "onmouseover"
table[1][1].fire_event "onmousedown"
table2 = ie.table(:class, "SubMenu")
table2[7][1].fire_event "onmousedown"
table2[7][1].fire_event "onmouseup"
如果您的凭据包含敏感信息,我强烈建议您更改密码,因为谷歌可能已将此主题编入索引
祝你好运!
Basim Baassiri