Skip to main content
Updated title to reflect problem in a more specific way, corrected spelling and punctuation, pretty-printed HTML
Source Link
testerab
  • 5.1k
  • 1
  • 32
  • 54

I am working on a project where I have to locate a button. I have used XPath for that, but the button's id changes on every refresh, so I am facing a problem withtwith that.. Below is a HTML excerpt. Let me know canhow I can identify that button so that it will not cause an error even if the id changes

<tr>
  <td/>
  <td>
    <div id="LoginButton" style="float: left;">
      <table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0">
        <tbody class="x-btn-small x-btn-icon-small-left">
          <tr>
            <td class="x-btn-tl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-tc"/>
            <td class="x-btn-tr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-ml">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-mc">
              <em class="" unselectable="on">
                <button class=" x-btn-text" id="ext-gen12" type="button">Login</button>
              </em>
            </td>
            <td class="x-btn-mr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-bl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-bc"/>
            <td class="x-btn-br">
              <i>&nbsp;</i>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </td>
</tr>

I am working on a project where I have to locate a button. I have used XPath for that, but button's id changes on every refresh, so I am facing problem witht that.. Below is HTML excerpt. Let me know can I identify that button so that it will not cause error even if id changes

<tr>
  <td/>
  <td>
    <div id="LoginButton" style="float: left;">
      <table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0">
        <tbody class="x-btn-small x-btn-icon-small-left">
          <tr>
            <td class="x-btn-tl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-tc"/>
            <td class="x-btn-tr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-ml">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-mc">
              <em class="" unselectable="on">
                <button class=" x-btn-text" id="ext-gen12" type="button">Login</button>
              </em>
            </td>
            <td class="x-btn-mr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-bl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-bc"/>
            <td class="x-btn-br">
              <i>&nbsp;</i>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </td>
</tr>

I am working on a project where I have to locate a button. I have used XPath for that, but the button's id changes on every refresh, so I am facing a problem with that. Below is a HTML excerpt. Let me know how I can identify that button so that it will not cause an error even if the id changes

<tr>
  <td/>
  <td>
    <div id="LoginButton" style="float: left;">
      <table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0">
        <tbody class="x-btn-small x-btn-icon-small-left">
          <tr>
            <td class="x-btn-tl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-tc"/>
            <td class="x-btn-tr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-ml">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-mc">
              <em class="" unselectable="on">
                <button class=" x-btn-text" id="ext-gen12" type="button">Login</button>
              </em>
            </td>
            <td class="x-btn-mr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-bl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-bc"/>
            <td class="x-btn-br">
              <i>&nbsp;</i>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </td>
</tr>
Updated title to reflect problem in a more specific way, corrected spelling and punctuation, pretty-printed HTML
Source Link

Facing issues in Identify Cannot locate button with changing ID in seleniumSelenium

I am working on 1a project, where iI have to locate a button, i. I have used xpathXPath for samethat, but buttonbutton's id changechanges on every refresh, so iI am facing problem in itwitht that.. Below is screenshot for same - letHTML excerpt. Let me know you can iI identify that button so that it will not cause error even if id changes

    <button type="button" id="ext-gen11" class=" x-btn-text">Login</button>

<tr>
                <td><<td/td>>
      <td>
    <div id="LoginButton" style="float: left;">
   <td><div id="LoginButton" style="float: left;"><table<table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0"><tbodycellspacing="0">
        <tbody class="x-btn-small x-btn-icon-small-left"><tr><tdleft">
          <tr>
            <td class="x-btn-tl"><i>&nbsp;<tl">
              <i>&nbsp;</i><i>
            </td><tdtd>
            <td class="x-btn-tc"><tc"/td><td>
            <td class="x-btn-tr"><i>&nbsp;<tr">
              <i>&nbsp;</i><i>
            </td><td>
          </tr><tr><tdtr>
          <tr>
            <td class="x-btn-ml"><i>&nbsp;<ml">
              <i>&nbsp;</i><i>
            </td><tdtd>
            <td class="x-btn-mc"><emmc">
              <em class="" unselectable="on"><buttonunselectable="on">
                <button class=" x-btn-text" id="ext-gen12" type="button">Login</button><button>
              </em><em>
            </td><tdtd>
            <td class="x-btn-mr"><i>&nbsp;<mr">
              <i>&nbsp;</i><i>
            </td><td>
          </tr><tr><tdtr>
          <tr>
            <td class="x-btn-bl"><i>&nbsp;<bl">
              <i>&nbsp;</i><i>
            </td><tdtd>
            <td class="x-btn-bc"><bc"/td><td>
            <td class="x-btn-br"><i>&nbsp;</i></td></tr></tbody></table><br">
              <i>&nbsp;</div><i>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </td>
</tr>

Facing issues in Identify button in selenium

I am working on 1 project, where i have to locate button, i have used xpath for same, but button id change on every refresh, so i am facing problem in it.. Below is screenshot for same - let me know you can i identify that button so that it will not cause error even if id changes

    <button type="button" id="ext-gen11" class=" x-btn-text">Login</button>

<tr>
                <td></td>
                <td><div id="LoginButton" style="float: left;"><table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0"><tbody class="x-btn-small x-btn-icon-small-left"><tr><td class="x-btn-tl"><i>&nbsp;</i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i>&nbsp;</i></td></tr><tr><td class="x-btn-ml"><i>&nbsp;</i></td><td class="x-btn-mc"><em class="" unselectable="on"><button class=" x-btn-text" id="ext-gen12" type="button">Login</button></em></td><td class="x-btn-mr"><i>&nbsp;</i></td></tr><tr><td class="x-btn-bl"><i>&nbsp;</i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i>&nbsp;</i></td></tr></tbody></table></div></td>
              </tr>

Cannot locate button with changing ID in Selenium

I am working on a project where I have to locate a button. I have used XPath for that, but button's id changes on every refresh, so I am facing problem witht that.. Below is HTML excerpt. Let me know can I identify that button so that it will not cause error even if id changes

<tr>
  <td/>
  <td>
    <div id="LoginButton" style="float: left;">
      <table style="width: auto;" id="ext-comp-1032" class="x-btn x-btn-noicon x-btn-over x-btn-focus" cellspacing="0">
        <tbody class="x-btn-small x-btn-icon-small-left">
          <tr>
            <td class="x-btn-tl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-tc"/>
            <td class="x-btn-tr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-ml">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-mc">
              <em class="" unselectable="on">
                <button class=" x-btn-text" id="ext-gen12" type="button">Login</button>
              </em>
            </td>
            <td class="x-btn-mr">
              <i>&nbsp;</i>
            </td>
          </tr>
          <tr>
            <td class="x-btn-bl">
              <i>&nbsp;</i>
            </td>
            <td class="x-btn-bc"/>
            <td class="x-btn-br">
              <i>&nbsp;</i>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </td>
</tr>
edited tags
Link
user246
user246
entire text was in code format. Moved question out of code formatted block.
Source Link
Lyndon Vrooman
  • 6.1k
  • 27
  • 52
Loading
Source Link
rohit ware
  • 155
  • 1
  • 3
  • 7
Loading