0

I'm learning Python and Selenium and I'm trying to complete an order and I need to enter the credit card information. The input is currently off the screen about half way down the page. I have this code:

paymentSection = driver.find_element_by_name("cardnumber")
driver.execute_script("arguments[0].scrollIntoView();", paymentSection)

Here is the HTML for the input I'm trying to get to:

<div class="CardNumberField-input-wrapper">
<span class="InputContainer" data-max="4242 4242 4242 4242 4240"><input class="InputElement is-empty Input Input--empty" autocomplete="cc-number" autocorrect="off" spellcheck="false" type="tel" name="cardnumber" aria-label="Credit or debit card number" placeholder="Card number" aria-invalid="false" value="">
</span>
</div>

Here is the error I'm getting: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [name="cardnumber"]

Lyle
  • 111
  • 1
  • 6
  • it would help to know what page you are trying to access – Chris Dec 14 '20 at 14:05
  • I believe this input field is located inside an [iframe](https://stackoverflow.com/questions/44834358/switch-to-an-iframe-through-selenium-and-python) – Parolla Dec 14 '20 at 14:18

0 Answers0