【发布时间】:2014-07-11 22:50:26
【问题描述】:
我有一个嵌套在表格层中的链接,并且大部分表格没有任何 ID。我拥有的链接位于包含 id 的表下。无论如何我都无法点击链接。这是html。请帮忙。谢谢!
<html
<frame src="my_frame"
<html
<table style="height:28px;"
<table style="height:28px;"
.
.
<table style="height:28px;"
<table id="tblButtons"
<td id="" title="" onmouseover="this.className = 'hdrBtn hdrBtnover';" onmouseout="this.className = 'hdrBtn';" onmousedown="this.className = 'hdrBtn hdrBtndown';" onmouseup="this.className = 'hdrBtn hdrBtnover';" background="../images/header/barbkg.gif" onclick="if(pageIsReady())parent.ordersummaryform.SubmitIt('OK');" class="hdrBtn"><a href="#" id="" class="linkForTabbingOnly" style="color:009900">Desktop</a></td>
<a href="#" id="" class="linkForTabbingOnly" style="color:009900">Desktop</a>
我尝试过如下使用 xpath:
link( :desktop_header, :xpath => "a[@href='#' and @class='linkForTabbingOnly' and starts-with(text(),'Desktop')]")
和
link( :desktop_header, :xpath => "//table[@id='tblButtons']//a[@href='#' and @class='linkForTabbingOnly' and starts-with(text(),'Desktop')]")
我也试过
我试过了
table(:table_button) {frame_element(:src => 'quotesummary_buttons.cfm?QuoteFormat=').table_element(:id => 'tblButtons',:href => '#', :class => 'linkForTabbingOnly' ) }
def click_desktop()
table_button_element.cell_element(:class => 'hdrBtn')
.child
.link_element(:text => 'Desktop')
.click
end
并使用 click_desktop 单击链接,但出现错误 NoMethodError:#
的未定义方法“frame_element”【问题讨论】:
标签: watir-webdriver page-object-gem