1
resposta

visitaPaginaParaCriarUmNovoLeilao não funciona - não acha o elemento com o id "novo_leilao_link"

org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.id: novo_leilao_link (tried for 5 second(s) with 500 milliseconds interval) at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272) at br.com.alura.leilao.e2e.pages.LeiloesPage.visitaPaginaParaCriarUmNovoLeilao(LeiloesPage.java:39) at br.com.alura.leilao.acceptance.steps.LeilaoSteps.acessa_a_pagina_de_novo_leilao(LeilaoSteps.java:30) at ✽.acessa a pagina de novo leilao(classpath:features/leilao.feature:10) Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#novo_leilao_link"} (Session info: chrome=89.0.4389.114) 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: 'MacBook-Pro-de-Usuario-5.local', ip: '192.168.0.21', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_252' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 89.0.4389.114, chrome: {chromedriverVersion: 88.0.4324.96 (68dba2d8a0b14..., userDataDir: /var/folders/06/4_30z_c97yn...}, goog:chromeOptions: {debuggerAddress: localhost:56133}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, 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: e835e10be2f0a3e9db5c9286c8b8e3d2 *** Element info: {Using=id, value=novo_leilao_link} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323) at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:372) at org.openqa.selenium.By$ById.findElement(By.java:188) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:182) at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:179) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249) at br.com.alura.leilao.e2e.pages.LeiloesPage.visitaPaginaParaCriarUmNovoLeilao(LeiloesPage.java:39) at br.com.alura.leilao.acceptance.steps.LeilaoSteps.acessa_a_pagina_de_novo_leilao(LeilaoSteps.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

1 resposta

Olá Carolina, tudo bem? Pelo erro apresentado, parece que o elemento com o id "novo_leilao_link" não foi encontrado na página. Isso pode acontecer por diversos motivos, como atraso no carregamento da página ou até mesmo um problema no código.

Uma sugestão é verificar se o elemento está presente na página e se o id está correto. Outra opção é verificar se o carregamento da página está sendo feito corretamente.

Caso essas sugestões não resolvam o problema, pode ser necessário revisar o código para encontrar o erro.

Espero ter ajudado e bons estudos!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software