Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 75941

Selenium - Send keys to input password in an iframe for Norwegian BankId

$
0
0

I want to do automatic testing using test data from here with Norwegian BankId. But I can't get hold of the input field using Selenium.

What I try to do:

  1. Go to https://www.banknorwegian.no/
  2. Click on "Logg inn"
  3. Click on "BankID på mobil."
  4. Click on "BankID" under "Alternativer for innlogging"
  5. Enter "02105892090" (test user from above link) and click on "Logg inn"
  6. Enter "02105892090" again in the "Engangskode" and click on the submit button.

    <iframe frameborder="0" width="100%" height="100%" src="<URL>" title="BankID">

    <div>Lots of divs...</div>

    <input data-bind=" attr: { maxlength: maxlength, type: type, id: id, 'data-type': dataType, disabled: disabled, 'aria-disabled': disabled, 'pattern': pattern, 'inputmode': 'numeric', 'max': $data.max, 'min': $data.min, 'step': $data.step, 'tabindex': $data.tabIndex, 'aria-invalid': isInvalid, 'aria-label': label }, value: val, valueUpdate: valueUpdate, css: { error: $data.err, hasFocus: hasFocus, hideCaret: $data.hideCaret, hasValue: hasValue }, event: { focus: onFocus, blur: onBlur }" autocomplete="off" autocapitalize="off" autocorrect="off" formnovalidate="" required="" maxlength="255" type="password" id="qxaTy_DZXMJPMnP_rZae_2" tabindex="2000" aria-invalid="true" pattern="[0-9]*" class="">

    </iframe>

I can get to (6.) but then I can't get hold of the input type="password" under "Engangskode". It's in an iframe which makes it harder. This is what I've tried:

public void EnterSsn(string ssn)
{
    var driver = WebDriverFacade.GetDriver;
    driver.SwitchTo().DefaultContent();

    driver.SwitchTo().Frame(0);

    Assert.IsTrue(driver.FindElement(By.CssSelector("input[type='password']")).ControlDisplayed());

    driver.FindElement(By.CssSelector("input[type='password']")).SendKeysWrapper(ssn, "SSN");
}

But I get the error message:

OpenQA.Selenium.NoSuchElementException : no such element: Unable to locate element: {"method":"css selector","selector":"input[type='password']"}

Does anyone have any idea how to do this?


Viewing all articles
Browse latest Browse all 75941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>