How do I accept user input using python tkinter and enter it into browser checkout using selenium web automation?

269 views Asked by At

I've been trying to write an automated checkout program that will allow a user to enter all their information into a tkinter gui. Then the code will automatically enter all that information into the checkout section of a website. An example is kind of like what a sneaker bot would do. HoweverI keep running into an error whenever I run the code.

The error message states:

AttributeError: 'WebElement' object has no attribute 'Name. 

I've done some research on how to fix it, but none of the forums specifically tackle the problem that I've been having. I've been using selenium and python to attempt to write this program.

Here is my code:

from selenium import webdriver

from selenium.webdriver.commom.keys import Keys

from tkinter import *

import time

root = Tk()

root.geometry("450x200")

def fetchName(Name):
    user = Name.get()
    print(user)

def Supreme():
    driver = webdriver.Chrome()
   driver.get('https://www.supremenewyork.com/shop/accessories/yws2o8zb6')
    driver.find_element_by_xpath('//*[@id="add-remove- 
    buttons"]/input').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[@id="cart"]/a[2]').click()
    driver.find_element_by_xpath('//* 
   [@id="order_billing_name"]').Name.get()

Name = Entry(root, width = 50, borderwidth = 5)
Name.pack()

b = Button(root, text = "Supreme", command = Supreme, width = 12, bg = 
'gray')
b.place(x = 175, y = 100)

root.mainloop()
0

There are 0 answers