1

The majority of my coding has gone well for creating a "kith" shopify automated purchasing tool. However, when I get to the payment page and search for the card number I get the error "driver not defined".

ex of code...

driver = webdriver.Chrome(executable_path=r'C:\webdrivers\Chromedriver.exe')
driver.get(str(url))
 
#size
driver.find_element_by_xpath('//div[@data-value="M"]').click()

#ATC
driver.find_element_by_xpath('//button[@class="btn product-form__add-to-cart"]').click()
time.sleep(6)
# x out of pop up 
driver.find_element_by_xpath('//button[@alt="Close form"]').click()

#checkout
driver.find_element_by_xpath('//button[@class="btn ajaxcart__checkout"]').click()
time.sleep(3)
#email
driver.find_element_by_xpath('//input[@placeholder="Email"]').send_keys('example@gmail.com')

#first
driver.find_element_by_xpath('//input[@placeholder="First name"]').send_keys('first')

#last
driver.find_element_by_xpath('//input[@placeholder="Last name"]').send_keys('last')

#address
driver.find_element_by_xpath('//input[@placeholder="Address"]').send_keys('address')

#city
driver.find_element_by_xpath('//input[@placeholder="City"]').send_keys('town')

#zip
driver.find_element_by_xpath('//input[@placeholder="ZIP code"]').send_keys('zip')

#phone number
driver.find_element_by_xpath('//input[@placeholder="Phone"]').send_keys('9999999999' + u'\ue007')
time.sleep(5)

#continue to payment
driver.find_element_by_xpath('//button[@type="submit"]').click()
time.sleep(8)

#payment page

driver.find_element_by_class_name('//iframe[@class="card-fields-iframe"]')
driver.find_element_by_xpath('//input[@placeholder="Card number" and @id= "number"]').send_keys('1234567812345678')

any ideas would help. The last 2 lines of code is where I get my problem. www.kith.com payment page

Mike67
  • 11,175
  • 2
  • 7
  • 15
corrupt
  • 31
  • 1
  • 4
  • Can You Post The Error,I cannot understand properly from what does you mean from searching credit card and you need to switch to iframe as well – Haseeb Ahmed Aug 16 '20 at 01:22
  • @HaseebAhmed I actually figured it out... I had to switch the driver to iframe <3 – corrupt Aug 18 '20 at 20:11

0 Answers0