1

Hey guys so I started working on an automated checkout for Amazon.

When it comes to filling the credit card info it cant pull any Elements as the ID changes over and over and it cant seem to find the text field through the name or class

cardnum = driver.find_element_by_name("addCreditCardNumber")
cardnum.click()

getting this error

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="addCreditCardNumber"]"}

nicolallias
  • 1,055
  • 2
  • 22
  • 51
Hassuni
  • 11
  • 4
  • The element might present inside an `iframe`.You need to switch the `iframe` in order to access any element inside `iframe` – KunduK Feb 01 '21 at 09:55
  • Can you explain a little closer? I don't quite understand what you mean – Hassuni Feb 01 '21 at 09:57
  • You should post the HTML source so we can help. Currently your code is looking for an element with name attribute. It will be easier to use XPATH to locate the element. – jackblk Feb 01 '21 at 10:35
  • My bad, sorry its my first time posting here something @jackblk `````` – Hassuni Feb 01 '21 at 11:12
  • If you check your DOM tree above the input element you find iframe tag and you need to post that as well.Thanks. – KunduK Feb 01 '21 at 11:48
  • Unfortunately i couldnt find it, i took you a screenshot if you could have a look at it i would really appreciate it, thank you very much :) https://ibb.co/pjYH04k – Hassuni Feb 01 '21 at 12:23

0 Answers0