0

My test suite experiences random trouble when running in a Tekton environment. Locally, there are no problems. The most annoying problem is when it claims to not find a selector, and the Cucumber run screenshot shows that the selector is indeed present at the time.

I've tried

Browser.Wait(15).until(ExpectedConditions.visibilityOf(driver.findElement(By.id("navn")))).sendKeys(selectAll + saksbehandlerInfo.getSaksbehandlerNavn());

Browser.Wait(15).until(ExpectedConditions.visibilityOf(driver.findElement(By.id("uid")))).sendKeys(selectAll + saksbehandlerInfo.getUid());

Browser.Wait(15).until(ExpectedConditions.visibilityOf(driver.findElement(By.id("kommunenummer")))).sendKeys(selectAll + saksbehandlerInfo.getKommuneNr());

But the recurring error is:

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#navn"}

Since the error is that Selenium is unable to locate the element, I wouldn't think there's a point in trying to check for .clickable() or any other state?

What's also a bit strange, is that it's allways the same element that it cannot find. There are 4 text fields on a login page, and it's allways the second that isn't found.

enter image description here

The markup:

<label for="uid">Saksbehandlerid</label>
<div><input id="uid" name="uid" value=""></div>
<label for="navn">Saksbehandlernavn</label>
<div><input id="navn" name="saksbehandlernavn" value=""></div>
<label for="kommunenummer">Kommunenummer</label>
<div><input id="kommunenummer" list="kommunenummer-choices" name="kommunenummer" value="">
  <datalist id="kommunenummer-choices">
    <option value="0301">BLabla</option>
  </datalist>
</div>
<label for="bydelsnummer">Bydelsnummer</label>
<div>
  <input id="bydelsnummer" list="bydelsnummer-choices" name="bydelsnummer" value="">
    <datalist id="bydelsnummer-choices">
      <option value="1">Blabla</option>
    </datalist>
</div>
<label for="roller">Roller</label>
  <div>
    <input type="hidden" name="_roller" value="1">
      <select id="roller" multiple="" name="roller">
        <option value="blabla>blabla</option>
     </select>
  </div>
<input type="submit" value="Log in">

The element failing is the second: <input id="navn".

Any ideas? If it wasn't for the fact that the run creates a screenshot when a test fails, which shows that the element is indeed present, I'd chalk it down to Tekton problems. But with a 15 second timout, and the element visibly present, I really cannot grasp why Selenium has problems?

  • The error is about searching by CSS while in the code you have search by id. I suspect there are fields annotated with "@FindBy" with CSS selectors. Please check how do you look for "saksbehandlerInfo" variable and/or other elements – Danny Briskin Oct 24 '22 at 16:28
  • Hm. Not sure what you mean? All the elements here are found by ID, as the posted code shows. driver.findElement(By.id("navn"), ("uid") and "kommunenummer". –  Oct 24 '22 at 19:41

0 Answers0