裏面我有類似HTML的無法點擊錨與圖像LI標籤
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<HTML>
<BODY class=" ext-border-box ext-ie ext-ie7 ext-windows" style="OVERFLOW: hidden">
<DIV class=" x-viewport x-component x-border-layout-ct" id="x-auto-0" style="WIDTH: 1280px; HEIGHT: 862px" __eventBits="16384">
<DIV class=" x-panel x-component x-border-panel" id="x-auto-9" style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; LEFT: 224px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 1054px; TOP: 35px; BORDER-RIGHT-WIDTH: 0px">
<DIV class="x-panel-bwrap"><DIV class="x-panel-body x-panel-body-noheader" style="WIDTH: 1054px; HEIGHT: 775px" __eventBits="16384">
<DIV class=" x-tab-panel x-component" id="x-auto-17" hideFocus style="WIDTH: 1052px" __eventBits="6909">
<DIV class="x-tab-panel-header x-unselectable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; WIDTH: 1052px" unselectable="on">
<DIV class="x-tab-strip-wrap" style="WIDTH: 1052px" role="presentation">
<UL class="x-tab-strip x-tab-strip-top">
<LI class="x-tab-strip-closable x-component x-tab-strip-active " id="x-auto-17__x-auto-180" hideFocus style="MozOutline: none" __eventBits="125" role="tab">
<A class="x-tab-strip-close" role="presentation"></A>
</LI>
</UL>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</BODY>
</HTML>
我不能夠點擊與<A>
標籤具有類屬性的對象。我嘗試過使用三種不同的方式
1. ie.link(:class,"x-tab-strip-close").click
2. ie.li(:class,"x-tab-strip-closable x-component x-tab-strip-active ").link(:class,"x-tab-strip-close").click
3. ie.li(:xpath,"//li[@class='x-tab-strip-close']").click
所有這三種類型導致元素未找到異常。請讓我知道如何點擊元素。
僅供參考在鏈接中沒有圖像,鏈接實際上是空的。你所看到的最有可能是一個'背景圖像',放在那裏爲這個特定的類由CSS –