51Testing软件测试论坛

标题: 如何定位ifram中table中td元素 [打印本页]

作者: crazy715    时间: 2011-7-27 21:43
标题: 如何定位ifram中table中td元素
<head>
<body>
<form id="form1" action="default.aspx" method="post">
<div class="aspNetHidden">
<div>
<div style="height: 99px;">
<div id="left_nav" style="height: 259px;">
<div style="margin-left: 190px; background-color: #F1F7FF;">
<iframe id="mainFrame" scrolling="auto" frameborder="0" style="background-color: rgb(241, 247, 255); height: 259px; width: 1090px;" onload="showHeight();" src="Pages/OrderingList.aspx" name="mainFrame">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<form id="form1" action="MenuManagerList.aspx" method="post">
<div class="aspNetHidden">
<div class="aspNetHidden">
<div id="list_nav">
<div class="lb_nav">
<div id="btn_nav">
<div style="margin: auto; margin-top: 6px;"> </div>
<div class="lb_nav_bg" style="border-top: #99bbe8 1px solid;">
<table class="listgrid_a" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse;">
<input id="hidFoodInfo" type="hidden" value="" name="hidFoodInfo">
<div id="menuFoodList" style="overflow: inherit;">
<table id="" class="listgrid_a" cellspacing="0" cellpadding="0" border="0" runat="server" style="border-collapse: collapse;">
<table id="" class="listgrid_a" cellspacing="0" cellpadding="0" border="0" runat="server" style="border-collapse: collapse;">
<table id="" class="listgrid_a" cellspacing="0" cellpadding="0" border="0" runat="server" style="border-collapse: collapse;">
<table id="" class="listgrid_a" cellspacing="0" cellpadding="0" border="0" runat="server" style="border-collapse: collapse;">
<tbody>
<tr>
<td style="width: 65px;" rowspan="61">周四(07月28日)</td>

以上是html代码,xpath不管用,使用itable=@ie.frame().table()
tr=itable.[](1)
td=tr.[](1)
也无法定位。。求助!!
作者: phoebe_kaka    时间: 2011-7-28 16:16
先定位到那张表。。@table=Browser.table(:index,1),index后面是你要定位的table的index。。。
作者: dvsam    时间: 2011-7-28 16:47
看晕了.
作者: crazy715    时间: 2011-7-29 09:21
回复 2# phoebe_kaka

谢谢你的提示,但是这个table是定位在frame里的
从frame定位到tabel就出问题了。后面更定位不到了。。
作者: phoebe_kaka    时间: 2011-7-29 10:20
额。。。不好意思。。我也刚接触watir。。。这样不行吗?
@table=ie.frame(:id,"mainFrame").table(:index,1)
作者: crazy715    时间: 2011-7-29 16:53
回复 5# phoebe_kaka

index的方法我还真没尝试过,我一直是使用xpath的,一直没有成功。。
作者: dvsam    时间: 2011-8-2 10:34
来了~来试验了
1)css=td
2)//div[@id='menuFoodList']/table[4]/tbody/tr/td




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2