0

Long story short, I am trying to create the back end of a sneaker bot for the Kith website (https://kith.com/). I am using the selenium library and its webdriver in order to web scrape and capture the website's elements. Everything seems to be fine until I reach the credit card input section. Once I try and copy the xpath for the input boxes (cc number, cvv, etc) it returns an error.

selenium.common.exceptions.NoSuchElementException: Message: no such element: 
Unable to locate element: {"method":"xpath","selector":"'//*[@id="number"]"}

Is there perhaps a feature within Html that disables you from grabbing and typing into this input box using the bot, or am I doing something wrong? If this is a legitimate feature, any bypass options?

My code to grab the input boxes are:

driver.find_element_by_xpath('//*[@id="number"]').send_keys(keys['cc_number'])
#Name on Card
driver.find_element_by_xpath('//*[@id=name"]').send_keys(keys['name_on_card'])
#exp date
driver.find_element_by_xpath('//*[@id="number"]').send_keys(keys['card_expiration_date'])
#security code
driver.find_element_by_id('//*[@id="number"]').send_keys(keys['card_cvv'])

This is the raw Html code for the CC # input box:

<input autocomplete="cc-number" id="number" name="number" type="tel" aria-describedby="error-for-number tooltip-for-number" data-current-field="number" class="input-placeholder-color--lvl-22" placeholder="Card number" style="color: rgb(51, 51, 51); font-family: Roboto, sans-serif; padding: 0.94em 0.8em; transition: padding 0.2s ease-out 0s;">

and then this is what value is copied every time I use its XPATH code //*[@id="number"]

King Lawson
  • 105
  • 4
  • 1
    I didn't create an account to verify, but usually, e-commerce websites will protect payment information fields. Some times they may be inside a ` – Bruno Monteiro Jan 17 '20 at 02:27
  • You've got three different elements that you're trying to find with `id=number`. id's are supposed to be unique. – John Gordon Jan 17 '20 at 02:27
  • @JohnGordon every time I go and copy the xpath, that's the only value that is copied `//*[@id="number"] ` – King Lawson Jan 17 '20 at 03:03
  • always put code, data and error mesages in question, not in comment - it will be more readable. – furas Jan 17 '20 at 03:15
  • when I check HTML in browser it has `id="cardNumber`, not `id="number"`. Similar other elements have different IDs then you shows. Maybe it shows different IDs for different cards. – furas Jan 17 '20 at 03:21
  • it is in ` – furas Jan 17 '20 at 03:24

0 Answers0