I have HTML like

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 14 February 2006), see www.w3.org">
    <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
    <title></title>
  </head>
  <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">
      <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">
            <div class=" x-tab-panel x-component" id="x-auto-17"
hidefocus=""
            style="WIDTH: 1052px">
              <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" role="tab">
                      <a class="x-tab-strip-close"
role="presentation"></a>
                    </li>
                  </ul>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

I would like to click element <a class="x-tab-strip-close"
role="presentation">. My watir code is as below

if ie.link(:class, "x-tab-strip-close").exist? == true
        begin
             ie.link(:class, "x-tab-strip-close").click

          rescue => e
              rescueHandle(e)
          end
else
     puts "FAILED! Could not find Class for Component"
         return false
end

code fails to identify the anchor link and always else block is
executed. Kindly help on how to locate the element.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to