Create Xpath manually

Asked

Viewed 530 times

0

I’m testing a site that runs only and exclusively in Internet Explorer, so I can’t use Firebug, someone knows how to create an Xpath of an element manually or knows some tool for IE that identifies this Xpath, similar to Firebug (IE Dev Tools does not do this job, I already use it).

With the HTML code below, I already reached two Xpaths, but Sleenium can not click any of them (already tried by name and id and do not click tbm, so the need for Xpath).

/html/body/center/table/tr[7]/td[1]/input/button and /html/body/center/table/tr[7]/td[1]/input/

I need to identify the double Xpath "OK"

 <tr>
        <td align="center" colspan="2">
            <input name="btnClose" type="button" class="button" value='OK'                      onclick="javascript:abrirSimulador();window.close();" />
        </td>
    </tr>


<html>
<head>
<title>
[Ativação] - Pré-Análise de Crédito
</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Expires" content="0">
<script type="text/javascript" src="/ativacao/js/jquery_noConflict.js"></script>
</head>

<body>

<script type="text/javascript">
    J(window).bind("beforeunload", function() { 
        abrirSimulador();
    })
</script>

<center><!-- Início da Página --> <!-- Título da Página --> <br>
<table border="0" cellpadding="0" cellspacing="0" width="350">
    <tr>
        <td class="page-title">Pré-Análise de Crédito</td>
    </tr>
    <tr>
        <td class="page-subtitle">Mensagem de Informação</td>
    </tr>
</table>
<br>

<table border="0" cellpadding="0" cellspacing="0" width="300" >
    <tr>
        <td class="label" align="right">
            Código da operação: &nbsp;
        </td>
        <td class="text">
        002PjPr
        </td>
    </tr>
    <!-- OS 81138 - Inicio -->

    <tr>
        <td class="label" align="right">
            Pontos: &nbsp;
        </td>
        <td class="text">
        1,00
        </td>
    </tr>
    <tr>
        <td class="label" align="right">
            Limite:  &nbsp;
        </td>
        <td class="text">
        1500,00
        </td>
    </tr>

        <!-- OS 81138 - Fim -->

    <!-- OS Unificação Cadastral II -->
    <tr>
        <td class="label" align="right">
            Cliente America Movel:  &nbsp;
        </td>
        <td class="text">

            Sim


        </td>
    </tr>
    <!-- OS Unificação Cadastral II -->
    <tr>
        <td class="label" align="right">
            Resposta:  &nbsp;
        </td>
        <td class="text">
        Prosseguir
        </td>
    </tr>
    <tr>
        <td class="label" align="right">
            Justificativa:  &nbsp;
        </td>
        <td class="text">
            Limite calculado. Favor prosseguir com a venda
        </td>
    </tr>
    c
</table>

</center>
</body>
<script type="text/javascript">
function abrirSimulador(){
    window.opener.prosseguirAnaliseCredito = false;

    if(window.opener.scorePreAnalise){
        window.opener.prosseguirAnaliseCredito = true;
        window.opener.checkAssociateSimularPrecoPreAnalise(window.opener.simulatePopup);
        return;
    }
    window.opener.scorePreAnalise = false;

}
</script>
</html>
  • Solved using the Autoit.

  • In your case, I believe xpath //input[@value='OK'] would be enough to locate the button.

1 answer

3

I don’t know if you’ve solved your problem yet, but names and id are only ever tried to write your xpath type like this: .//*[@name='btnClose'] ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.