2
respostas

elementnotinteractableerror element not interactable

Senhores Segue os trechos do meu código: `

            <tbody>
                <tr th:each="leilao : ${leiloes}" >
                    <td scope="row" th:text="${leilao.nome}" id="nome">Nome</td>
                    <td th:text="${#temporals.format(leilao.dataAbertura, 'dd/MM/yyyy')}" id="dataAbertura">10/02/2020</td>
                    <td th:text="${leilao.valorInicial}" id="valorInicial">Valor Inicial</td>
                    <td th:text="${leilao.usuario.nome}">Nome do Usuario</td>
                    <td sec:authorize="isAuthenticated()" th:if="${leilao.usuario.nome != usuarioLogado.name && leilao.aberto}">
                        <a class="btn btn-block btn-info" th:href="@{'/leiloes/' + ${leilao.id}}" >dar lance</a>
                    </td>
                    <td sec:authorize="isAuthenticated()" th:if="${leilao.usuario.nome == usuarioLogado.name} ">
                        <a class="btn btn-block btn-primary m-0" th:href="@{'/leiloes/' + ${leilao.id}} + '/form'">editar</a>
                    </td>
                </tr>
            </tbody>
        </table>  `

```public LeiloesPage(WebDriver browser) {
     this.browser = browser;
}

public LeiloesPage cadastrarLeilao(String nome, String valorInicial, String dataAbertura) { this.browser.findElement(By.id("nome")).sendKeys(nome); this.browser.findElement(By.id("valorInicial")).sendKeys(valorInicial); this.browser.findElement(By.id("dataAbertura")).sendKeys(dataAbertura); this.browser.findElement(By.id("button-submit")).submit();

    return new LeiloesPage(browser);
}

public boolean isLeilaoCadastrado(String nome, String valor, String data) { WebElement linhaDaTabela = this.browser.findElement(By.cssSelector("#tabela-leiloes tbody tr:last-child")); WebElement colunaNome = linhaDaTabela.findElement(By.cssSelector("td:nth-child(1)")); WebElement colunaDataAbertura = linhaDaTabela.findElement(By.cssSelector("td:nth-child(2)")); WebElement colunaValorInicial = linhaDaTabela.findElement(By.cssSelector("td:nth-child(3)"));

     return colunaNome.getText().equals(nome)
                && colunaDataAbertura.getText().equals(data) 
                && colunaValorInicial.getText().equals(valor);
}

`

NomeData de aberturaValor inicialUsuario
2 respostas

Oi Francisco,

Posta aqui tambem o erro completo que apareceu no console do eclipse ao rodar o teste, para a gente entender melhor onde pode estar o problema.

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#nome"} (Session info: chrome=90.0.4430.93) For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'lee-X550CA', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.8.0-50-generic', java.version: '15.0.1' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 90.0.4430.93, chrome: {chromedriverVersion: 90.0.4430.24 (4c6d850f087da..., userDataDir: /tmp/.com.google.Chrome.3VVeZM}, goog:chromeOptions: {debuggerAddress: localhost:43387}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true} Session ID: 90abac1cb284e42aba444b87624b1a64 *** Element info: {Using=id, value=nome} at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)