Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น ภาษา Java ภาษา Python

Moderator: mindphp, ผู้ดูแลกระดาน

ธวัชชัย แสนหาญ
PHP Super Member
PHP Super Member
โพสต์: 384
ลงทะเบียนเมื่อ: 15/11/2018 10:02 am

Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย ธวัชชัย แสนหาญ » 11/02/2019 12:22 pm

Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

รูปภาพ

โค้ดที่ใช้

โค้ด: เลือกทั้งหมด

from tkinter import *
from tkinter import messagebox
import sys
from python_test import T2



def login_mooziicart(event):
    T2.user = t1
    T2.password = t2
    print(t1)
    print(t2)


def test00_Exit(event):
    status = messagebox.askyesno(title='คำยืนยัน', message='ปิดหรือไม่')  # ปิดโปรแกรม
    if status > 0:
        print('กด off')
        sys.exit()

def test_Case_Categories(event):

    CC = 1
    print(CC)


gui = Tk()
gui.geometry("450x450")  # ขนาดframe กว้าง*สูง
gui.title("MooZii Cart")  # ชื่อframe


l01=Label(text='User:')
l02=Label(text='Password:')
l01.grid(row=1)
l02.grid(row=2)

t1=Entry(textvariable=StringVar())
t2=Entry(show='*' ,textvariable=StringVar())
t1.grid(row=1, column=1)
t2.grid(row=2, column=1)


b2 = Button(text='Login', bg='#EEDDFF', font=('Times', '10', 'bold'))
b2.bind('<Button-1>', login_mooziicart)
b2.grid(row=2, column=2)
# รายการที่เทส
l1 = Label(text='Categories', bg='#80FF80', font=('Times', '15', 'bold'))
l1.grid(row=3)

b1 = Button(text='TEST', bg='#80FF80', font=('Times', '10', 'bold'))
b1.bind('<Button-1>', test_Case_Categories)
b1.grid(row=3, column=1)

b0 = Button(text='ปิดโปรแกรม', bg='red', font=('Times', '10', 'bold'))
b0.bind('<Button-1>', test00_Exit)
b0.grid(row=10, )

gui.mainloop()



ผลรัน
ลองสั่ง print ค่าตัวแปรที่เก็บจากช่องรับข้อมูล user , password
รูปภาพ

ภาพประจำตัวสมาชิก
tatiya
PHP VIP Members
PHP VIP Members
โพสต์: 1046
ลงทะเบียนเมื่อ: 09/07/2018 9:35 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย tatiya » 11/02/2019 3:11 pm

ในปุ่มต้องมี command ให้ action ไปที่ method ที่จะ print ค่าด้วยครับ
<input type=”button” name=”button” id=”button” value=”Click” />

ภาพประจำตัวสมาชิก
tatiya
PHP VIP Members
PHP VIP Members
โพสต์: 1046
ลงทะเบียนเมื่อ: 09/07/2018 9:35 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย tatiya » 11/02/2019 3:20 pm

โค้ด: เลือกทั้งหมด

def setUp():

    print(e1.get())
    print(e2.get())


from tkinter import *
master = Tk()
Label(master, text="ชื่อผู้ใช้  :").grid(row=0)
Label(master, text="รหัสผ่าน :").grid(row=1)
Label(master, text="PATH WEBDRIVER :").grid(row=2)

e1 = Entry(master)
e2 = Entry(master, show="*")
e3 = Entry(master)
e4 = Label(master, text= "test")

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
e4.grid(row=3, column=1)



Button(master, text='เริ่มทำงาน', command=setUp).grid(row=6, column=1, sticky=W, pady=100)

Button(master, text='ปิดการทำงาน', command=master.quit).grid(row=6, column=2, sticky=W, pady=100)

master.title("test")
master.geometry("600x300")
mainloop()
<input type=”button” name=”button” id=”button” value=”Click” />

ธวัชชัย แสนหาญ
PHP Super Member
PHP Super Member
โพสต์: 384
ลงทะเบียนเมื่อ: 15/11/2018 10:02 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย ธวัชชัย แสนหาญ » 12/02/2019 11:30 am

tatiya เขียน:

โค้ด: เลือกทั้งหมด

def setUp():

    print(e1.get())
    print(e2.get())


from tkinter import *
master = Tk()
Label(master, text="ชื่อผู้ใช้  :").grid(row=0)
Label(master, text="รหัสผ่าน :").grid(row=1)
Label(master, text="PATH WEBDRIVER :").grid(row=2)

e1 = Entry(master)
e2 = Entry(master, show="*")
e3 = Entry(master)
e4 = Label(master, text= "test")

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
e4.grid(row=3, column=1)



Button(master, text='เริ่มทำงาน', command=setUp).grid(row=6, column=1, sticky=W, pady=100)

Button(master, text='ปิดการทำงาน', command=master.quit).grid(row=6, column=2, sticky=W, pady=100)

master.title("test")
master.geometry("600x300")
mainloop()

ผมทำคล้ายแบบโค้ด แต่ให้รับค่ามาเก็บไว้ในตัวแปร อีกไฟล์
แบบนี้ครับ Edit01_Mooziicart.user = t1.get()
คือให้เก็บข้อมูลของ t1.get() ไว้ใน ตัวแปร user ในไฟล์ Edit01_Mooziicart
มันเกิด errorครับ
ต้องแก้ยังไงครับ
โค้ด

โค้ด: เลือกทั้งหมด

10def login_mooziicart(event):
11    Edit01_Mooziicart.user = t1.get()
12    Edit01_Mooziicart.password = t2.get()
13
14    print(t1.get())
15    print(t2.get())


ข้อความerror

Exception in Tkinter callback
Traceback (most recent call last):
File "
C:\Users\ter\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "
D:/Python selenium_mt27/python_test/Mt27/selenium_moozii/test_selenium_error01.py", line 11, in login_mooziicart
Edit01_Mooziicart.user = t1.get()
AttributeError: 'Button' object has no attribute 'get'

ภาพประจำตัวสมาชิก
tatiya
PHP VIP Members
PHP VIP Members
โพสต์: 1046
ลงทะเบียนเมื่อ: 09/07/2018 9:35 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย tatiya » 12/02/2019 6:19 pm

ขอตัวอย่างโค้ดทั้งหมดหน่อยสิ
AttributeError: 'Button' object has no attribute 'get'
โค้ดส่วน Button ผิดหรือป่าว

def login_mooziicart(event):
Edit01_Mooziicart.user = t1.get()
Edit01_Mooziicart.password = t2.get()

print(t1.get())
print(t2.get())

ดูแค่นี้จะรู้มั้ย

- ค่าที่ปริ้น เฉยๆมันมามั้ย
- ส่งค่าไปอีกไฟล์ แล้วตรงไหนที่เรียกใช้งานไฟล์ที่ส่งค่าไป
<input type=”button” name=”button” id=”button” value=”Click” />

ธวัชชัย แสนหาญ
PHP Super Member
PHP Super Member
โพสต์: 384
ลงทะเบียนเมื่อ: 15/11/2018 10:02 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย ธวัชชัย แสนหาญ » 12/02/2019 6:23 pm

โค้ดเต็มครับ

โค้ด: เลือกทั้งหมด

from python_test.Mt27.selenium_moozii import Edit01_Mooziicart
from tkinter import ttk
def Exit(self):

    status=messagebox.askyesno(title='คำยืนยัน',message='ปิดหรือไม่')#ปิดโปรแกรม
    if status>0:
        print('กด off')
        sys.exit()

def login_mooziicart(event):
    Edit01_Mooziicart.user = t1.get()
    Edit01_Mooziicart.password = t2.get()

    print(t1.get())
    print(t2.get())

def Case_Categories(self):
    print('Case Categories')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการเทส Case Categories ใช่หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Categories").grid(row=1)
        top1.geometry("450x200")  # ขนาดframe กว้าง*สูง
        top1.title("Case Categories")  # ชื่อframe
        b2 = Button(top1,text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', login_mooziicart)
        b2.grid(row=1, column=1)

        Mlable = Label(top1, text='text1:')
        Mlable.grid(row=2)
        Mlable = Label(top1, text='text2:')
        Mlable.grid(row=3)
        Mlable = Label(top1, text='text3:')
        Mlable.grid(row=4)
        Mlable = Label(top1, text='text4:')
        Mlable.grid(row=5)
        Mlable = Label(top1, text='text5:')
        Mlable.grid(row=6)
        Mlable = Label(top1, text='text6:')
        Mlable.grid(row=7)


        ct1 = Entry(top1,textvariable=StringVar())
        ct2 = Entry(top1,textvariable=StringVar())
        ct3 = Entry(top1, textvariable=StringVar())
        ct4 = Entry(top1, textvariable=StringVar())
        ct5 = Entry(top1, textvariable=StringVar())
        ct6 = Entry(top1, textvariable=StringVar())
        ct1.grid(row=2, column=1)
        ct2.grid(row=3, column=1)
        ct3.grid(row=4, column=1)
        ct4.grid(row=5, column=1)
        ct5.grid(row=6, column=1)
        ct6.grid(row=7, column=1)



def Case_Products(self):
    print('Case Products')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการเทส Case Products ใช่หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Products").grid(row=1)
        top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
        top1.title("Case Products")  # ชื่อframe
        b2 = Button(top1,text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', login_mooziicart)
        b2.grid(row=1, column=1)

        Mlable = Label(top1, text='text1:')
        Mlable.grid(row=2)
        Mlable = Label(top1, text='text2:')
        Mlable.grid(row=3)
        Mlable = Label(top1, text='text3:')
        Mlable.grid(row=4)
        Mlable = Label(top1, text='text4:')
        Mlable.grid(row=5)
        Mlable = Label(top1, text='text5:')
        Mlable.grid(row=6)
        Mlable = Label(top1, text='text6:')
        Mlable.grid(row=7)


        pt1 = Entry(top1,textvariable=StringVar())
        pt2 = Entry(top1,textvariable=StringVar())
        pt3 = Entry(top1, textvariable=StringVar())
        pt4 = Entry(top1, textvariable=StringVar())
        pt5 = Entry(top1, textvariable=StringVar())
        pt6 = Entry(top1, textvariable=StringVar())
        pt1.grid(row=2, column=1)
        pt2.grid(row=3, column=1)
        pt3.grid(row=4, column=1)
        pt4.grid(row=5, column=1)
        pt5.grid(row=6, column=1)
        pt6.grid(row=7, column=1)


def Case_Orders(self):
    print('Case Orders')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการเทส Case Orders ใช่หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Orders").grid(row=1)
        top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
        top1.title("Case Orders")  # ชื่อframe
        b2 = Button(top1,text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', login_mooziicart)
        b2.grid(row=1, column=1)

        Mlable = Label(top1, text='text1:')
        Mlable.grid(row=2)
        Mlable = Label(top1, text='text2:')
        Mlable.grid(row=3)
        Mlable = Label(top1, text='text3:')
        Mlable.grid(row=4)
        Mlable = Label(top1, text='text4:')
        Mlable.grid(row=5)
        Mlable = Label(top1, text='text5:')
        Mlable.grid(row=6)
        Mlable = Label(top1, text='text6:')
        Mlable.grid(row=7)


        ot1 = Entry(top1,textvariable=StringVar())
        ot2 = Entry(top1,textvariable=StringVar())
        ot3 = Entry(top1, textvariable=StringVar())
        ot4 = Entry(top1, textvariable=StringVar())
        ot5 = Entry(top1, textvariable=StringVar())
        ot6 = Entry(top1, textvariable=StringVar())
        ot1.grid(row=2, column=1)
        ot2.grid(row=3, column=1)
        ot3.grid(row=4, column=1)
        ot4.grid(row=5, column=1)
        ot5.grid(row=6, column=1)
        ot6.grid(row=7, column=1)



def Case_Clients(self):
    print('Case Clients')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการเทส Case Clients ใช่หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Clients").grid(row=1)
        top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
        top1.title("Case Clients")  # ชื่อframe
        b2 = Button(top1,text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', login_mooziicart)
        b2.grid(row=1, column=1)

        Mlable = Label(top1, text='text1:')
        Mlable.grid(row=2)
        Mlable = Label(top1, text='text2:')
        Mlable.grid(row=3)
        Mlable = Label(top1, text='text3:')
        Mlable.grid(row=4)
        Mlable = Label(top1, text='text4:')
        Mlable.grid(row=5)
        Mlable = Label(top1, text='text5:')
        Mlable.grid(row=6)
        Mlable = Label(top1, text='text6:')
        Mlable.grid(row=7)


        clt1 = Entry(top1,textvariable=StringVar())
        clt2 = Entry(top1,textvariable=StringVar())
        clt3 = Entry(top1, textvariable=StringVar())
        clt4 = Entry(top1, textvariable=StringVar())
        clt5 = Entry(top1, textvariable=StringVar())
        clt6 = Entry(top1, textvariable=StringVar())
        clt1.grid(row=2, column=1)
        clt2.grid(row=3, column=1)
        clt3.grid(row=4, column=1)
        clt4.grid(row=5, column=1)
        clt5.grid(row=6, column=1)
        clt6.grid(row=7, column=1)



def Case_Options(self):
    print('Case Options')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการเทส Case Options ใช่หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Options").grid(row=1)
        top1.geometry("550x300")  # ขนาดframe กว้าง*สูง
        top1.title("Case Options")  # ชื่อframe


        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Manufacturers)
        b2.grid(row=2, column=1)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Coupons )
        b2.grid(row=3, column=1)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Currencies )
        b2.grid(row=4, column=1)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Bank )
        b2.grid(row=5, column=1)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Taxes )
        b2.grid(row=6, column=1)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Payments )
        b2.grid(row=7, column=1)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Shipping_methods )
        b2.grid(row=8, column=1)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Shipping_prices )
        b2.grid(row=9, column=1)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Delivery_time )
        b2.grid(row=10, column=1)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Order_status )
        b2.grid(row=2, column=3)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Country_list )
        b2.grid(row=3, column=3)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Province )
        b2.grid(row=4, column=3)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Amphur )
        b2.grid(row=5, column=3)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_District )
        b2.grid(row=6, column=3)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Attributes )
        b2.grid(row=7, column=3)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Free_attributes )
        b2.grid(row=8, column=3)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Units_of_measure )
        b2.grid(row=9, column=3)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_User_groups )
        b2.grid(row=10, column=3)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Vendors )
        b2.grid(row=2, column=5)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Product_comments )
        b2.grid(row=3, column=5)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Product_labels )
        b2.grid(row=4, column=5)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Product_Characteristics )
        b2.grid(row=5, column=5)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Languages )
        b2.grid(row=6, column=5)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Import_Export )
        b2.grid(row=7, column=5)
        b2 = Button(top1, text='Test', bg='#80FF80', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Addons )
        b2.grid(row=8, column=5)
        b2 = Button(top1, text='Test', bg='#53FF53', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', Case_Test_Statistic)
        b2.grid(row=9, column=5)

        Mlable = Label(top1, text='Manufacturers:')
        Mlable.grid(row=2,sticky='e')
        Mlable = Label(top1, text='Coupons:')
        Mlable.grid(row=3,sticky='e')
        Mlable = Label(top1, text='Currencies:')
        Mlable.grid(row=4,sticky='e')
        Mlable = Label(top1, text='Bank:')
        Mlable.grid(row=5,sticky='e')
        Mlable = Label(top1, text='Taxes:')
        Mlable.grid(row=6,sticky='e')
        Mlable = Label(top1, text='Payments:')
        Mlable.grid(row=7,sticky='e')
        Mlable = Label(top1, text='Shipping methods:')
        Mlable.grid(row=8,sticky='e')
        Mlable = Label(top1, text='Shipping prices:')
        Mlable.grid(row=9,sticky='e')
        Mlable = Label(top1, text='Delivery time:')
        Mlable.grid(row=10,sticky='e')
        Mlable = Label(top1, text='Order status:')
        Mlable.grid(row=2 ,column=2,sticky='e')
        Mlable = Label(top1, text='Country list:')
        Mlable.grid(row=3,column=2,sticky='e')
        Mlable = Label(top1, text='Province:')
        Mlable.grid(row=4,column=2,sticky='e')
        Mlable = Label(top1, text='Amphur:')
        Mlable.grid(row=5,column=2,sticky='e')
        Mlable = Label(top1, text='District:')
        Mlable.grid(row=6,column=2,sticky='e')
        Mlable = Label(top1, text='Attributes:')
        Mlable.grid(row=7,column=2,sticky='e')
        Mlable = Label(top1, text='Free attributes:')
        Mlable.grid(row=8,column=2,sticky='e')
        Mlable = Label(top1, text='Units of measure:')
        Mlable.grid(row=9,column=2,sticky='e')
        Mlable = Label(top1, text='User groups:')
        Mlable.grid(row=10,column=2,sticky='e')
        Mlable = Label(top1, text='Vendors:')
        Mlable.grid(row=2,column=4,sticky='e')
        Mlable = Label(top1, text='Product comments:')
        Mlable.grid(row=3,column=4,sticky='e')
        Mlable = Label(top1, text='Product labels:')
        Mlable.grid(row=4,column=4,sticky='e')
        Mlable = Label(top1, text='Product Characteristics:')
        Mlable.grid(row=5,column=4,sticky='e')
        Mlable = Label(top1, text='Languages:')
        Mlable.grid(row=6,column=4,sticky='e')
        Mlable = Label(top1, text='Import & Export:')
        Mlable.grid(row=7,column=4,sticky='e')
        Mlable = Label(top1, text='Addons:')
        Mlable.grid(row=8,column=4,sticky='e')
        Mlable = Label(top1, text='Statistic:')
        Mlable.grid(row=9,column=4,sticky='e')
def Case_Test_Manufacturers(self):
    print('Case Manufacturers')
    top1 = Toplevel(gui)
    Label(top1, text="Manufacturers").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Manufacturers")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Coupons(self):
    print('Case Coupons')
    top1 = Toplevel(gui)
    Label(top1, text="Coupons").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Coupons")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Currencies(self):
    print('Case Statistic')
    top1 = Toplevel(gui)
    Label(top1, text="Statistic").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Statistic")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Bank(self):
    print('Case Bank')
    top1 = Toplevel(gui)
    Label(top1, text="Bank").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Bank")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Taxes(self):
    print('Case Taxes')
    top1 = Toplevel(gui)
    Label(top1, text="Taxes").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Taxes")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Payments(self):
    print('Case Payments')
    top1 = Toplevel(gui)
    Label(top1, text="Payments").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Payments")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Shipping_methods(self):
    print('Case Shipping methods')
    top1 = Toplevel(gui)
    Label(top1, text="Shipping methods").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Shipping methods")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Shipping_prices(self):
    print('Case Shipping prices')
    top1 = Toplevel(gui)
    Label(top1, text="Shipping prices").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Shipping prices")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Delivery_time(self):
    print('Case Delivery time')
    top1 = Toplevel(gui)
    Label(top1, text="Delivery time").grid(row=1)
    top1.geometry("450x450")
    top1.title("Case Delivery time")
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    cst1 = Entry(top1, textvariable=StringVar())
    cst2 = Entry(top1, textvariable=StringVar())
    cst3 = Entry(top1, textvariable=StringVar())
    cst4 = Entry(top1, textvariable=StringVar())
    cst5 = Entry(top1, textvariable=StringVar())
    cst6 = Entry(top1, textvariable=StringVar())
    cst1.grid(row=2, column=1)
    cst2.grid(row=3, column=1)
    cst3.grid(row=4, column=1)
    cst4.grid(row=5, column=1)
    cst5.grid(row=6, column=1)
    cst6.grid(row=7, column=1)
def Case_Test_Order_status(self):
    print('Case Order status')
    top1 = Toplevel(gui)
    Label(top1, text="Order status").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Order status")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Country_list(self):
    print('Case Country list')
    top1 = Toplevel(gui)
    Label(top1, text="Country list").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Country list")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Province(self):
    print('Case Province')
    top1 = Toplevel(gui)
    Label(top1, text="Province").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Province")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Amphur(self):
    print('Case Amphur')
    top1 = Toplevel(gui)
    Label(top1, text="Amphur").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Amphur")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_District(self):
    print('Case District')
    top1 = Toplevel(gui)
    Label(top1, text="District").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case District")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Attributes (self):
    print('Case Attributes')
    top1 = Toplevel(gui)
    Label(top1, text="Attributes").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Attributes")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Free_attributes(self):
    print('Case Free attributes')
    top1 = Toplevel(gui)
    Label(top1, text="Free attributes").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Free attributes")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Units_of_measure(self):
    print('Case Units of measure')
    top1 = Toplevel(gui)
    Label(top1, text="Units of measure").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Units of measure")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_User_groups(self):
    print('Case User groups')
    top1 = Toplevel(gui)
    Label(top1, text="User groups").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case User groups")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Vendors(self):
    print('Case Vendors')
    top1 = Toplevel(gui)
    Label(top1, text="Vendors").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Vendors")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Product_comments(self):
    print('Case Product comments')
    top1 = Toplevel(gui)
    Label(top1, text="Product comments").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Product comments")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Product_labels(self):
    print('Case Product labels')
    top1 = Toplevel(gui)
    Label(top1, text="Product labels").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Product labels")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Product_Characteristics(self):
    print('Case Product Characteristics')
    top1 = Toplevel(gui)
    Label(top1, text="Product Characteristics").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Product Characteristics")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Languages(self):
    print('Case Languages')
    top1 = Toplevel(gui)
    Label(top1, text="Languages").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Languages")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Import_Export(self):
    print('Case Import & Export')
    top1 = Toplevel(gui)
    Label(top1, text="Import & Export").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Import & Export")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Addons(self):
    print('Case Addons')
    top1 = Toplevel(gui)
    Label(top1, text="Addons").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Addons")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)
def Case_Test_Statistic(self):
    print('Case Statistic')
    top1 = Toplevel(gui)
    Label(top1, text="Statistic").grid(row=1)
    top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
    top1.title("Case Statistic")  # ชื่อframe
    b2 = Button(top1, text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
    b2.bind('<Button-1>', login_mooziicart)
    b2.grid(row=1, column=1)

    Mlable = Label(top1, text='text1:')
    Mlable.grid(row=2)
    Mlable = Label(top1, text='text2:')
    Mlable.grid(row=3)
    Mlable = Label(top1, text='text3:')
    Mlable.grid(row=4)
    Mlable = Label(top1, text='text4:')
    Mlable.grid(row=5)
    Mlable = Label(top1, text='text5:')
    Mlable.grid(row=6)
    Mlable = Label(top1, text='text6:')
    Mlable.grid(row=7)

    ot1 = Entry(top1, textvariable=StringVar())
    ot2 = Entry(top1, textvariable=StringVar())
    ot3 = Entry(top1, textvariable=StringVar())
    ot4 = Entry(top1, textvariable=StringVar())
    ot5 = Entry(top1, textvariable=StringVar())
    ot6 = Entry(top1, textvariable=StringVar())
    ot1.grid(row=2, column=1)
    ot2.grid(row=3, column=1)
    ot3.grid(row=4, column=1)
    ot4.grid(row=5, column=1)
    ot5.grid(row=6, column=1)
    ot6.grid(row=7, column=1)




def Case_Test_CaseShopping(self):
    print('Case Shopping')
    status = messagebox.askyesno(title='คำยืนยัน', message=' คุณต้องการคุณต้องการเทส Case Shopping ใช้หรือไม่')
    if status > 0:
        top1 = Toplevel(gui)
        Label(top1, text="Shopping").grid(row=1)
        top1.geometry("450x450")  # ขนาดframe กว้าง*สูง
        top1.title("Case Shopping")  # ชื่อframe

        b2 = Button(top1,text='Run', bg='#EEDDFF', font=('Times', '10', 'bold'))
        b2.bind('<Button-1>', login_mooziicart)
        b2.grid(row=1, column=1)

        Mlable = Label(top1, text='text1:')
        Mlable.grid(row=2)
        Mlable = Label(top1, text='text2:')
        Mlable.grid(row=3)
        Mlable = Label(top1, text='text3:')
        Mlable.grid(row=4)
        Mlable = Label(top1, text='text4:')
        Mlable.grid(row=5)
        Mlable = Label(top1, text='text5:')
        Mlable.grid(row=6)
        Mlable = Label(top1, text='text6:')
        Mlable.grid(row=7)


        cst1 = Entry(top1,textvariable=StringVar())
        cst2 = Entry(top1,textvariable=StringVar())
        cst3 = Entry(top1, textvariable=StringVar())
        cst4 = Entry(top1, textvariable=StringVar())
        cst5 = Entry(top1, textvariable=StringVar())
        cst6 = Entry(top1, textvariable=StringVar())
        cst1.grid(row=2, column=1)
        cst2.grid(row=3, column=1)
        cst3.grid(row=4, column=1)
        cst4.grid(row=5, column=1)
        cst5.grid(row=6, column=1)
        cst6.grid(row=7, column=1)



from tkinter import *
from tkinter import messagebox
import sys

# สร่้างหน้าจอ
gui=Tk()
gui.geometry("400x400") #ขนาดframe กว้าง*สูง
gui.title("MooZii Cart") #ชื่อframe

Mlable=Label(text='BACK-END',fg='green',bg='#CCFFFF',font=('Times','15','bold'))
Mlable.grid(row=2)
Mlable=Label(text='FRONT-END',fg='green',bg='#CCFFFF',font=('Times','15','bold'))
Mlable.grid(row=9)

l01 = Label(text='User:',font=('Times','15','bold'))
l02 = Label(text='Password:',font=('Times','15','bold'))
l01.grid(row=0)
l02.grid(row=1)

t1 = Entry(textvariable=StringVar())
t2 = Entry(show='*', textvariable=StringVar())
t1.grid(row=0, column=1)
t2.grid(row=1, column=1)

b2 = Button(text='Login', bg='#EEDDFF', font=('Times', '10', 'bold'))
b2.bind('<Button-1>', login_mooziicart)
b2.grid(row=1, column=2)
    # รายการที่เทส
l1=Label(text='Categories',bg='#80FF80',font=('Times','12','bold'))
l2=Label(text='Product',bg='#53FF53',font=('Times','12','bold'))
l3=Label(text='Orders',bg='#80FF80',font=('Times','12','bold'))
l4=Label(text='Clients',bg='#53FF53',font=('Times','12','bold'))
l5=Label(text='Options',bg='#80FF80',font=('Times','12','bold'))

l8=Label(text='Case Shopping',bg='#80FF80',font=('Times','12','bold'))

l1.grid(row=3)
l2.grid(row=4)
l3.grid(row=5)
l4.grid(row=6)
l5.grid(row=7)

l8.grid(row=10)

t1=Button(text='TEST',bg='#80FF80',font=('Times','10','bold'))
t1.bind('<Button-1>',Case_Categories)
t2=Button(text='TEST',bg='#53FF53',font=('Times','10','bold'))
t2.bind('<Button-1>',Case_Products)
t3=Button(text='TEST',bg='#80FF80',font=('Times','10','bold'))
t3.bind('<Button-1>',Case_Orders)
t4=Button(text='TEST',bg='#53FF53',font=('Times','10','bold'))
t4.bind('<Button-1>',Case_Clients)
t5=Button(text='TEST',bg='#80FF80',font=('Times','10','bold'))
t5.bind('<Button-1>',Case_Options)
t8=Button(text='TEST',bg='#80FF80',font=('Times','10','bold'))
t8.bind('<Button-1>',Case_Test_CaseShopping)

t1.grid(row=3,column=1)
t2.grid(row=4,column=1)
t3.grid(row=5,column=1)
t4.grid(row=6,column=1)
t5.grid(row=7,column=1)

t8.grid(row=10,column=1)

b0=Button(text='ปิดโปรแกรม',bg='red',font=('Times','10','bold'))
b0.bind('<Button-1>',Exit)
b0.grid(row=11,column=2)





gui.mainloop()


ธวัชชัย แสนหาญ
PHP Super Member
PHP Super Member
โพสต์: 384
ลงทะเบียนเมื่อ: 15/11/2018 10:02 am

Re: Q - ต้องการ รับค่าจาก ช่องรับข้อมูล มาเก็บไว้ในตัวแปรทำไง

โพสต์โดย ธวัชชัย แสนหาญ » 12/02/2019 6:30 pm

อีกไฟล์ 1 ครับ ที่เรียกใช้

โค้ด: เลือกทั้งหมด

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.select import Select
import time, base64, re, requests ,unittest,os




user = ""
password = ""
user1 = "ธวัชชัย แสนหาญ"
password1 = "0929462162"
user2 ='mt77'
password2 ='87654321'
path = r'E:\geckodriver-v0.23.0-win64\geckodriver.exe'
wed0 = "http://mzc.buildinstore.com/administrator/index.php"
wed1 = "http://mzc.buildinstore.com/index.php/en/"
wed_mindphp = "https://www.mindphp.com/forums/viewforum.php?f=342" #https://www.mindphp.com/forums/posting.php?mode=post&f=342
firefoxpath = "/home/com015/geckodriver"
Toggle  = "//a[contains(.,'Toggle editor')]"
new = '.button-new'
save = '.button-apply'
save_close ='.button-save'
Cancel ='.button-cancel'
Public ='.button-publish'
Unpublic ='.button-unpublish'
delete ='#toolbar-delete > button.btn.btn-small'
Detail ='Details'
pw1 ='passwd'
pw2 ='password'
'categories'
CategoryTitle = 'book'
CategoryTitle1 = 'Book'
Alias ='book'
Short_description = 'book'
Description = 'book'
Access ='Public'
Category_sorting ='First'
Amount_of_products_on_page ='10'
Amount_of_products_in_row ='5'
Parent_category ='Top level'
categoriesfile_edit ='book'
'Product'
ProductTitle = 'One Piece'
ProductTitle1 = 'One Piece2'
ProductAlias = 'One Piece'
ProductShort_description = 'One Piece'
ProductDescription = 'One Piece'
access = 'Public'
price = '30'
currency = 'บาท'
Amount_of_product_in_stock = '20'
tax_id = 'Normal (5.00%)'
category_id = 1
lable = 'No'
Productfile_edit = 'One Piece'
'Clients'
ClientsUsername = 'MT001'
ClientsUsername1 = 'MT0011'
ClientsEmail = 'MT001@gmail.com'
ClientsPassword = '543210'
ClientsUsergroup = 'group A'
Clientsfile_edit = 'MT001'
'Manufacturers'
ManufacturersTitle = 'test Grand Home (Chaina) Co.,Ltd.'
ManufacturersTitle1 = 'Grand Home (Chaina) Co.,Ltd.'
ManufacturersAlias = 'Grand Home'
ManufacturersShort_description = 'Grand Home (Chaina)'
ManufacturersDescription = 'Grand Home (Chaina) Co.,Ltd.'
ManufacturersURL = 'www.GrandHome.co.th'
ManufacturersAmount_of_products_on_page ='10'
ManufacturersAmount_of_products_in_row ='10'
Manufacturersfile_edit = 'test Grand Home (Chaina) Co.,Ltd.'
'Coupons'
CouponsCode = '300'
CouponsCode1 = '3000'
Coupons_type_n = 1 #"(Percent)=1 ; (Value)=2"
CouponsValue = '30'
CouponsStart_date = '2018-12-15'
CouponsExpire_date = '2019-12-25'
Couponsfor_user_id = '0'
Couponsfile_edit = '300'
'Currencies'
Currencies_Title = 'USD'
Currencies_Title1 = 'USD1'
Currencies_Code = 'USD'
Code_ISO = 'USD'
Code_Numeric = 'USD'
Course_of_exchange = '1'
Currenciesfile_edit = 'USD'
'Bank'
Bank_Code = 'Asia Bank'
Bank_Name = 'test ธนาคารเอเชีย(มหาชน)'
Bank_Name1 = 'test1 ธนาคารเอเชีย(มหาชน)'
Bankfile_edit = 'test ธนาคารเอเชีย(มหาชน)'
'Taxes'
Tax_Title = 'ภาษี ณ ที่จ่าย'
Tax_Title1 = 'ภาษี ข่นส่ง'
Tax_Value = '10'
Extended_rule_tax = 2
List_of_tax_rules_Title='ภาษี ณ ที่จ่าย (10.00%)'
List_of_tax_rules_Country='209'
Tax='22'
Company_tax='11'
Taxesfile_edit = 'ภาษี ณ ที่จ่าย'
'Payment'
Title_Payment = "Coupon payments"
Title_Payment1 = "mobile payments"
Alias_Payment = "pm_Coupon"
Alias_Payment1 = "pm_mobile"
Please_select_tax_Payment = "ภาษี ณ ที่จ่าย (10.00%)"
Paymentfile_edit = 'Coupon payments'
'Shipping methods'
Shippingfile_edit = 'Free Shipping'
Title_Shipping = "Free Shipping"
Title_Shipping1 = "Flat Rate"
Delivery_methods_prices = 3
Country_Shipping = 1
Price_Shipping = 0
Tax_Shipping = "ภาษี0% (0.00%)"
Tax_Shipping1 = "Normal (5.00%)"
Package_Price_Shipping = 0
Package_Tax_Shipping = "ภาษี0% (0.00%)"
Package_Tax_Shipping1 = "Normal (5.00%)"
'Delivery time'
Title_en = 'test003'
Title_en1 = 'test033'
Title_th = 'test003'
Days = '30'
Delivery_timefile_edit = 'test003'
'Order status'
status_Title_en = 'Return the product'
status_Title_en1 = 'R t p'
status_Title_th = 'Return the product'
status_Code = 'r'
Order_statusfile_edit = 'Return the product'
'Country list'
Country_Title_en = 'test Mexico'
Country_Title_en1 = 'test1 Mexico'
Country_Title_th = 'Mexico'
Country_Code = 'Mex'
Country_Code2 = 'Mx'
Country_listfile_edit = 'test Mexico'
'Province'
Province_Code = '59'
Province_Name_en = 'Nakhon Pathom'
Province_Name_en1 = 'Nakhon Pathom1'
Province_Name_th = 'นครปฐม'
Provincefile_edit = 'Nakhon Pathom'
'Amphur'
ProvinceName = '58'
AmphurCode = '7308'
AmphurName_en = 'Kamphangsang'
AmphurName_en1 = 'Kamphangsang1'
AmphurName_th = 'กำแพงแสน'
Postcode = '17308'
Amphurfile_edit = 'Kamphangsang'
'District'
District_ProvinceName = '58'
District_AmphurName = '2'
Districtcode = '730209'
DistrictName_en = 'Thung Khwang'
DistrictName_en1 = 'Thung Khwang1'
DistrictName_th = 'ทุ่งขวาง'
Districtfile_edit = 'Thung Khwang'
'Attributes'
Attributes_Title_en = 'light'
Attributes_Title_en1 = 'light1'
Attributes_Title_th = 'light'
Type = 'Radio'
Dependent = '1' # 0,1
Show_for_categories = '1'
category_No = '1'
Attributesfile_edit = 'light'
'Free_attributes'
Free_attributesfile_edit ='solid'
Free_attributes_Title_en ='solid'
Free_attributes_Title_en1 ='solid1'
Free_attributes_Title_th ='ของแข็ง'
Free_attributes_description_en ='solid'
Free_attributes_description_th ='ของแข็ง'
'Units of measure'
unit_en='m'
unit_en1 = 'mm'
unit_th='m'
unitfile_edit='m'
'User groups'
Usergroups_Title_en='group1'
Usergroups_Title_en1='group11'
Usergroups_Title_th='group1'
Discount='20'
Description_en='Customers1'
Description_th='Customers1'
User_groupsfile_edit = 'group1'
'Product comments'
prodoct_ID = '27'
Productuser = 'mt27'
Productemail = 'mt27@gmail.com'
comment = 'ดี'
Product_commentsfile_edit = 'football'
'Product labels'
name_en = 'SALE 40%'
name_en1 = 'SALE 45%'
name_th = 'ลดราคา 40%'
Product_labelsfile_edit = 'SALE 40%'
'Product Characteristics'
P_C_edit ='fluid'
P_C_Title_en ='fluid'
P_C_Title_en1 ='fluid1'
P_C_Title_th ='ของเหลว'
P_C_description_en ='fluid'
P_C_description_th ='ของเหลว'
Show_categories_All ='tr:nth-child(5) #\31-lbl'
Show_categories_selected ='#allcats0'
P_C_Show_categories =Show_categories_selected
P_C_categories = 1  #category_id > option:nth-child(2)
Type_List='#type0'
Type_Multiple_List='#\-1'
Type_Text='tr:nth-child(7) #\31'
P_C_Type =Type_List
'Import & Export'
file = 'Simple Export'
file_name = 'Export02'
Import_Exportfile_edit = 'Export02'
'Create_Account'
cneme = 'botmt27'
cusername = 'botmt27'
cpassword = 'botmt27007'
cemail = 'mt27.mdsoft@gmail.com'
'Cart'
Category ='sport'
Product ='football'
Title ='Mr.'
First_name ='mt77'
Last_name ='mt77'
Email ='mt77.mdsoft@gmail.com'
Street_No ='77'
Postal_Code ='73140'
City ='1'
Country ='Thailand'
phone ='0929462162'
payment =1
Update_cart ='.quantity img'
Back_to_shop ='.btn-arrow-left'
Buy =2
information_css ="input[name='rabatt']"
Delete=1
Activate ='.button.btn'
directory='report'
Standard='.name:nth-child(1) b'
Express='.name:nth-child(2) b'
class joomla(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Firefox(executable_path=path)  # __builtin__.firefoxpath)
        self.base_url = wed0  # __builtin__.base_url #=
        self.base_url1 = wed1  # __builtin__.base_url1 #=
        self.username = user  # __builtin__.username #=
        self.username1 = user1  # __builtin__.username1 #=
        self.username2 = user2  # __builtin__.username1 #=
        self.pwd = password  # __builtin__.pwd #=
        self.pwd1 = password1  # __builtin__.pwd1 #=
        self.pwd2 = password2  # __builtin__.pwd1 #=
        self.verificationErrors = []
        self.accept_next_alert = True
        self.wait = WebDriverWait(self.driver, 10)
        # self.driver.maximize_window()




    def msg_error(self):
        for i in range(5):
            try:
                if self.driver.find_element_by_css_selector("div.alert.alert-error"):
                    obj = self.driver.find_element_by_css_selector("div.alert.alert-error")
                    msg = obj.text
                    self.msg = msg
                    break
            except:
                pass
            print(i)
            time.sleep(1)
        else:
            msg = "ไม่มี"
            self.msg = msg


    def report_error(self):
        'Report'
        Error_test = self.case
        Error_test1 = str(Error_test)
        driver = self.driver
        # obj = self.driver.find_element_by_xpath("/html/body")
        # msg = obj.text

        self.msg_error()
        Url = self.driver.current_url  # เก็บ URL ไว้ในตัวแปร
        snap = self.driver.get_screenshot_as_base64()
        text = str(snap)#snap
        base = "data:image/png;base64," + text
        url = "http://snap.mindphp.com/index.php"
        files = {'paths': base, 'upload': 'upload', 'from_python': 'true'}
        response = requests.post(url, data=files)
        url_img = response.text
        url_snap_img = "http://snap.mindphp.com/index.php%s" % url_img

        self.driver.get(wed_mindphp)
        for i in range(4):
            try:
                if self.driver.find_element_by_name("username"):
                    login = self.wait.until(ec.visibility_of_element_located((By.NAME, "username")))
                    ActionChains(self.driver).move_to_element(login).perform()
                    a = self.driver.find_element_by_name("username")
                    a.clear()
                    a.send_keys(user1)
                    a = self.driver.find_element_by_name("password")
                    a.clear()
                    a.send_keys(password1)
                    time.sleep(3)
                    self.driver.find_element_by_name("login").click()
                    time.sleep(5)
                    print('login')
                    break

            except:
                if self.driver.find_element_by_link_text("ตั้งกระทู้ใหม่"):
                    print("ตั้งกระทู้ใหม่")
                    break

                pass
            print("ทำใหม่")
            time.sleep(2)
        else:
            print("error")
        self.driver.find_element_by_link_text("ตั้งกระทู้ใหม่").click()
        a = self.driver.find_element_by_name("subject")
        a.clear()
        a.send_keys("B - เว็บระบบของ Moozii cart มีปัญหาที่ %s" % Error_test1)
        a = self.driver.find_element_by_name("message")
        a.clear()
        a.send_keys("[color=#FF0000][size=150]เกิดปัญหา moozii cart ขัดข้อง ที่ Case  %s[/size][/color]\n"% Error_test1)
        a.send_keys('\n')
        a.send_keys('ข้อความError : [color=#FF0000]%s[/color] \n' % self.msg)
        a.send_keys('ตำแหน่งที่ Error : [color=#FF0000]%s[/color] \n' % self.msg1)
        a.send_keys('link error : %s \n' % Url)
        a.send_keys('user : %s\n' % user)
        a.send_keys('password : %s\n' % password)
        a.send_keys('[img]%s[/img]\n' % url_snap_img)
        # self.driver.find_element_by_name("post").click()
        self.driver.find_element_by_name("preview").click()
        time.sleep(15)
        driver.quit()

    def openwed_Login(self,elementpwd,wed,user,password):
        'Login เข้าระบบ Joomla'
        self.case = self.openwed_Login.__doc__

        self.driver.get(wed)
        driver = self.driver

        for i in range(10):
            try:

                if self.driver.find_element_by_name("username"):
                    break
                print(self.driver.get(wed))


            except:
                pass
            print("ทำใหม่")
            time.sleep(2)
        else:
            print("error")
            self.msg1 = 'wed error'
            self.report_error()
            driver.quit()
        login = self.wait.until(ec.visibility_of_element_located((By.NAME, "username")))
        ActionChains(self.driver).move_to_element(login).perform()
        a = self.driver.find_element_by_name("username")
        a.clear()
        a.send_keys(user)
        a = self.driver.find_element_by_name(elementpwd)
        a.clear()
        a.send_keys(password)
        a = self.driver.find_element_by_css_selector(".btn-primary")
        a.submit()
        time.sleep(5)

    def menu_MooZiiCart(self,menu):
        menu = menu
        driver = self.driver
        self.wait.until(ec.visibility_of_element_located((By.LINK_TEXT, "Components")))
        self.driver.find_element_by_link_text("Components").click()

        for i in range(10):
            try:
                if self.driver.find_element_by_link_text("MooZiiCart"):break
            except:
                pass
            print("หาใหม่")
            time.sleep(2)
        else:
            print("error")
            self.msg1 = 'MooZiiCart'
            self.report_error()
            driver.quit()
        time.sleep(2)
        self.driver.find_element_by_link_text("MooZiiCart").click()

        for i in range(10):
            try:
                if self.driver.find_element_by_xpath("//span[contains(.,'%s')]"%menu): break
            except:
                pass
            time.sleep(2)
        else:
            print ("report bug")
            self.msg1 = menu
            self.report_error()
            driver.quit()
        time.sleep(3)
        self.driver.find_element_by_xpath("//span[contains(.,'%s')]" % menu).click()
    def xpath_click(self, element):
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath(element):break
            except:
                pass
            print('x%d' % i)
            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        self.driver.find_element_by_xpath(element).click()

    def find(self, element):
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath(element):break
            except:
                pass
            print('x%d' % i)
            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        element1 = self.driver.find_element_by_xpath(element)
        self.driver.execute_script("arguments[0].click();", element1)

    def find_css(self, element):
        for i in range(10):
            try:
                if self.driver.find_element_by_css_selector(element): break
            except:
                pass
            time.sleep(2)
        else:
            print("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        self.driver.find_element_by_css_selector(element).click()

    def find_linktext(self, element):
        for i in range(10):
            try:
                if self.driver.find_element_by_link_text(element): break
            except:
                pass
            time.sleep(2)
        else:
            print("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        self.driver.find_element_by_link_text(element).click()

    def Confirm(self):
        obj = self.driver.switch_to.alert
        msg = obj.text
        print("Alert shows following message: " + msg)
        time.sleep(2)
        obj.accept()
        print(" Clicked on the OK Button in the Alert Window")
        time.sleep(5)

    def information_name (self,element,information):
        for i in range(10):

            try:
                if self.driver.find_element_by_name(element):
                    a = self.driver.find_element_by_name(element)
                    a.clear()
                    a.send_keys(information)
                    break
            except:
                pass
            print("pass%d"%i)

            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)

    def open_file(self,file):
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath("//a[contains(.,'%s')]" % file):
                    break
            except:
                pass
            print('หาใหม่')

            time.sleep(1)
        else:
            print("Error")
            self.msg1 = file
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        element1 = self.driver.find_element_by_xpath("//a[contains(.,'%s')]" % file)
        self.driver.execute_script("arguments[0].click();", element1)
    def check_file(self,file):
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath("//a[contains(.,'%s')]" % file):
                    break
            except:
                pass
            print('check file : %d' % i)

            time.sleep(1)
        else:
            print("Error")
            self.msg1 = file
            self.report_error()
            self.driver.quit()
        print('check pass')

    def Dropdown(self,element,text):
        for i in range(10):
            try:
                if self.driver.find_element_by_name(element):break
            except:
                pass
            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        select = Select(self.driver.find_element_by_name(element))
        select.select_by_visible_text(text)

    def box(self, boxtr ,boxtd):
        print("xpath=//form[@id='adminForm']/table/tbody/tr[%d]/td[%d]/input"  %(boxtr,boxtd))
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath("//form[@id='adminForm']/table/tbody/tr[%d]/td[%d]/input"  %(boxtr,boxtd)):
                    element1 = self.driver.find_element_by_xpath("//form[@id='adminForm']/table/tbody/tr[%d]/td[%d]/input" % (boxtr, boxtd))
                    self.driver.execute_script("arguments[0].click();", element1)
                    break
            except:

                pass
            time.sleep(2)
        else:
            print('error box')
            self.msg1 = "box%d"%boxtr
            self.report_error()
            self.driver.quit()

    def menu_buy (self,buy):
        for i in range(10):
            try:
                if self.driver.find_element_by_xpath("(//a[contains(text(),'Buy')])[%d]" %buy):break
            except:
                pass
            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = "Buy%d"%buy
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        element1 = self.driver.find_element_by_xpath("(//a[contains(text(),'Buy')])[%d]" %buy)
        self.driver.execute_script("arguments[0].click();", element1)


    def information_css (self,element,information):
        for i in range(10):
            try:
                if self.driver.find_element_by_css_selector(element):break
            except:
                pass
            print("pass")
            time.sleep(2)
        else:
            print ("Error")
            self.msg1 = element
            self.report_error()
            self.driver.quit()
        time.sleep(3)
        a = self.driver.find_element_by_css_selector(element)
        a.send_keys(information)

    def check_Delete(self, check):
        for i in range(5):
           try:
               if self.driver.find_element_by_css_selector(".row0:nth-child(1) #cb0"):break

           except:
               pass
           time.sleep(1)
        else:
            self.msg1 = "wed error"
            self.report_error()
            self.driver.quit()
        for i in range(5):
            try:
                if self.driver.find_element_by_xpath("//a[contains(.,'%s')]" % check):
                    print('c1')
                    self.report_error()
                    break
            except:

                pass
        else:
            print('check pass')
            self.driver.quit()

    def check_show(self ,box ,td):

        n = box % 2
        if n == 1:
            m = n - 1
        else:
            m = n + 1

        print('.row%d:nth-child(%d) > td:nth-child(%d) > a'% (m, box, td))
        for i in range(10):
            try:
                if self.driver.find_element_by_css_selector('.row%d:nth-child(%d) > td:nth-child(%d) > a'% (m, box, td)):
                    ojb = self.driver.find_element_by_css_selector('.row%d:nth-child(%d) > td:nth-child(%d) > a' % (m, box,td))
                    msg = ojb.text
                    self.msg1 = msg                          #.row0:nth-child(3) > td:nth-child(3) > a
                    break
            except:
                pass
            print(i)
            time.sleep(1)
        else:
            print('error check show')
            self.msg1 = 'ไม่มี box%d'%box
            self.report_error()
            self.driver.quit()

    def check_show_P_A_D(self, box, td):



        print('.row0:nth-child(%d) > td:nth-child(%d) > a' % ( box, td))
        for i in range(10):
            try:
                if self.driver.find_element_by_css_selector('.row0:nth-child(%d) > td:nth-child(%d) > a' % ( box, td)):
                    ojb = self.driver.find_element_by_css_selector('.row0:nth-child(%d) > td:nth-child(%d) > a' % (box, td))
                    msg = ojb.text
                    self.msg1 = msg  # .row0:nth-child(3) > td:nth-child(3) > a
                    break
            except:
                pass
            print(i)
            time.sleep(1)
        else:
            print('error check show')
            self.msg1 = 'ไม่มี box%d' % box
            self.report_error()
            self.driver.quit()

    def Options(self):
        'Options'
        self.openwed_Login(pw1, self.base_url, self.username, self.pwd)
        self.case = self.Options.__doc__
        self.menu_MooZiiCart('Options')

    def Configuration(self):
        'Options'
        self.openwed_Login(pw1, self.base_url, self.username, self.pwd)
        self.case = self.Options.__doc__
        self.menu_MooZiiCart('Configuration')

class MooZiiCart_check(joomla):

    def Shop_functions_check_Add(self):
        'Add categories'

        driver = self.driver

        self.Configuration()
        self.case = self.Shop_functions_check_Add.__doc__
        self.menu_MooZiiCart("Shop functions")
        self.find_css(new)
        self.find(Toggle)
        self.information_name('name_en-GB',CategoryTitle)
        self.information_name('alias_en-GB',Alias)
        self.information_name('short_description_en-GB', Short_description)
        self.information_name('description1', Description)
        self.find_linktext('Description (th)')
        self.information_name('name_th-TH', CategoryTitle)
        self.information_name('alias_th-TH', Alias)
        self.information_name('short_description_th-TH', Short_description)
        self.find("//*[@id='th-TH-page']/div[1]/table/tbody/tr[4]/td[2]/div/div[2]/div/a")
        self.information_name('description2', Description)
        self.find_linktext(Detail)
        self.Dropdown('access',Access)
        self.Dropdown('ordering',Category_sorting)
        self.information_name('products_page',Amount_of_products_on_page)
        self.information_name('products_row',Amount_of_products_in_row)
        self.Dropdown('category_parent_id',Parent_category)
        self.find_css(save_close)
        self.check_file(CategoryTitle)
        driver.quit()

    def categories_check_Add(self):
        'Add categories'

        driver = self.driver

        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.categories_check_Add.__doc__
        self.menu_MooZiiCart("Categories")
        self.find_css(new)
        self.find(Toggle)
        self.information_name('name_en-GB',CategoryTitle)
        self.information_name('alias_en-GB',Alias)
        self.information_name('short_description_en-GB', Short_description)
        self.information_name('description1', Description)
        self.find_linktext('Description (th)')
        self.information_name('name_th-TH', CategoryTitle)
        self.information_name('alias_th-TH', Alias)
        self.information_name('short_description_th-TH', Short_description)
        self.find("//*[@id='th-TH-page']/div[1]/table/tbody/tr[4]/td[2]/div/div[2]/div/a")
        self.information_name('description2', Description)
        self.find_linktext(Detail)
        self.Dropdown('access',Access)
        self.Dropdown('ordering',Category_sorting)
        self.information_name('products_page',Amount_of_products_on_page)
        self.information_name('products_row',Amount_of_products_in_row)
        self.Dropdown('category_parent_id',Parent_category)
        self.find_css(save_close)
        self.check_file(CategoryTitle)
        driver.quit()
    def Product_check_Add(self):
        'Add Product'
        driver = self.driver
        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.Product_check_Add.__doc__
        self.menu_MooZiiCart('Products')
        self.find_css(new)
        self.find(Toggle)
        self.information_name('name_en-GB', ProductTitle)
        self.information_name('alias_en-GB', ProductAlias)
        self.information_name('short_description_en-GB', ProductShort_description)
        self.information_name('description1', ProductDescription)
        self.find_linktext('Description (th)')
        self.information_name('name_th-TH', ProductTitle)
        self.information_name('alias_th-TH', ProductAlias)
        self.information_name('short_description_th-TH', ProductShort_description)
        self.find("//*[@id='th-TH-page']/div[1]/table/tbody/tr[4]/td[2]/div/div[2]/div/a")
        self.information_name('description2', ProductDescription)
        self.find_linktext(Detail)
        self.Dropdown('access',access)
        self.information_name('product_price',price)
        self.Dropdown('currency_id',currency)
        self.information_name('product_quantity', Amount_of_product_in_stock)
        self.Dropdown('product_tax_id', tax_id)
        self.find_css("#category_id > option:nth-child(%d)" % category_id)
        self.Dropdown('label_id', lable)
        self.find_css(save_close)
        self.check_file(ProductTitle)
        driver.quit()

    def Orders_check_Add(self):
        'Add Orders'
        driver = self.driver
        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.Orders_check_Add.__doc__
        self.menu_MooZiiCart('Orders')
        self.find_css(new)
        self.find_css(".span10 > input")
        self.Dropdown('user_id','MT27 mt27')
        self.find("//input[@value='Add Product']")
        self.find("(//a[contains(text(),'Load')])[2]")

        self.find('//*[@id="adminForm"]/table/tbody/tr[1]/td[3]/b/a')
        time.sleep(5)
        self.information_name('order_subtotal','200')
        self.find_css(save_close)

        driver.quit()
    def Clients_check_Add(self):
        'Add Clients'

        driver = self.driver
        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.Clients_check_Add.__doc__
        self.menu_MooZiiCart('Clients')
        self.find_css(new)
        self.information_name('u_name', ClientsUsername)
        self.information_name('email', ClientsEmail)
        self.information_name('password', ClientsPassword)
        self.information_name('password2', ClientsPassword)
        self.Dropdown('usergroup_id',ClientsUsergroup)
        self.find_css(save_close)
        self.check_file(ClientsUsername)
        driver.quit()
    def Options_check_Add(self):
        'Click Options'
        driver = self.driver
        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.Options_check_Add.__doc__
        self.menu_MooZiiCart('Options')
        driver.quit()
    def Manufacturers_check_Add(self):
        'Add Manufacturers'
        driver = self.driver
        self.Options()
        self.case = self.Manufacturers_check_Add.__doc__
        self.find_linktext('Manufacturers')
        self.find_css(new)
        self.find(Toggle)
        self.information_name('name_en-GB', ManufacturersTitle)
        self.information_name('alias_en-GB', ManufacturersAlias)
        self.information_name('short_description_en-GB', ManufacturersShort_description)
        self.information_name('description1', ManufacturersDescription)
        self.find_linktext('Description (th)')
        self.information_name('name_th-TH', ManufacturersTitle)
        self.information_name('alias_th-TH', ManufacturersAlias)
        self.information_name('short_description_th-TH', ManufacturersShort_description)
        self.find("//*[@id='th-TH-page']/div[1]/table/tbody/tr[4]/td[2]/div/div[2]/div/a")
        self.information_name('description2', ManufacturersDescription)
        self.find_linktext(Detail)
        self.information_name('manufacturer_url', ManufacturersURL)
        self.information_name('products_page', ManufacturersAmount_of_products_on_page)
        self.information_name('products_row', ManufacturersAmount_of_products_in_row)
        self.find_css(save_close)
        self.check_file(ManufacturersTitle)
        driver.quit()
    def Coupons_check_Add(self):
        'Add Coupons'
        driver = self.driver
        self.Options()
        self.case = self.Coupons_check_Add.__doc__
        self.find_linktext('Coupons')
        self.find_css(new)
        self.find_css('tr:nth-child(1) input')
        self.information_name('coupon_code', CouponsCode)
        self.find("//label[%d]/input" % Coupons_type_n)
        self.information_name('coupon_value', CouponsValue)
        self.information_name('coupon_start_date', CouponsStart_date)
        self.information_name('coupon_expire_date', CouponsExpire_date)
        self.information_name('for_user_id', Couponsfor_user_id)
        self.find_css('tr:nth-child(8) input')
        self.find_css(save_close)
        self.check_file(CouponsCode)
        driver.quit()
    def Currencies_check_Add(self):
        'Add Currencies'
        driver = self.driver
        self.Options()
        self.case = self.Currencies_check_Add.__doc__
        self.find_linktext('Currencies')
        self.find_css(new)
        self.find_css('tr:nth-child(1) input')
        self.information_name('currency_name', Currencies_Title)
        self.information_name('currency_code', Currencies_Code)
        self.information_name('currency_code_iso', Code_ISO)
        self.information_name('currency_code_num', Code_Numeric)
        self.information_name('currency_value', Course_of_exchange)
        self.find_css(save_close)
        self.check_file(Currencies_Title)
        driver.quit()
    def Bank_check_Add(self):
        'Add Bank'
        driver = self.driver
        self.Options()
        self.case = self.Bank_check_Add.__doc__
        self.find_linktext('Bank')
        self.find_css(new)
        self.information_name('bank_code', Bank_Code)
        self.information_name('bank_name', Bank_Name)
        self.find_css(save_close)
        self.check_file(Bank_Name)
        driver.quit()
    def Taxes_check_Add(self):
        'Add Taxes'
        driver = self.driver
        self.Options()
        self.case = self.Taxes_check_Add.__doc__
        self.find_linktext('Taxes')
        self.find_css(new)
        self.information_name('tax_name', Tax_Title)
        self.information_name('tax_value', Tax_Value)
        self.find_css(save_close)
        self.find("//tr[%d]/td[4]/a" % Extended_rule_tax)
        self.find_css(new)
        self.Dropdown('tax_id', List_of_tax_rules_Title)
        self.find_css("option[value='%s']" % List_of_tax_rules_Country)
        self.information_name('tax', Tax)
        self.information_name('firma_tax', Company_tax)
        self.find_css(save_close)
        self.check_file(Tax_Title)
        driver.quit()
    def Payment_check_Add(self):
        'Add Payment'
        driver = self.driver
        self.Options()
        self.case = self.Payment_check_Add.__doc__
        self.find_linktext('Payments')
        self.find_css(new)
        self.find_css("tr:nth-child(1) input")
        self.information_name('name_en-GB', Title_Payment)
        self.information_name('name_th-TH', Title_Payment)
        self.information_name('payment_class', Alias_Payment)
        self.Dropdown('tax_id', Please_select_tax_Payment)
        self.find_css(save_close)
        self.check_file(Title_Payment)
        driver.quit()
    def Shipping_methods_check_Add(self):
        'Add Shipping methods'
        driver = self.driver
        self.Options()
        self.case = self.Shipping_methods_check_Add.__doc__
        self.find_linktext('Shipping methods')
        self.find_css(new)
        self.find_css("tr:nth-child(1) input")
        self.information_name('name_en-GB', Title_Shipping)
        self.information_name('name_th-TH', Title_Shipping)
        self.find_css(save_close)
        self.find_css(".button-cog")
        self.find_css(".btn-small")
        self.find("//tr[%d]/td[4]/a"% Delivery_methods_prices)
        self.find_css(new)
        self.find_css("#shipping_countries_id > option:nth-child(%d)"%Country_Shipping)
        self.information_name('shipping_stand_price', Price_Shipping)
        self.Dropdown('shipping_tax_id', Tax_Shipping)
        self.information_name('package_stand_price', Package_Price_Shipping)
        self.Dropdown('package_tax_id', Package_Tax_Shipping)
        self.find_css(save_close)
        self.check_file(Title_Shipping)
        driver.quit()


    def Delivery_time_check_Add(self):
        'Add Delivery time'
        driver = self.driver
        self.Options()
        self.case = self.Delivery_time_check_Add.__doc__
        self.find_linktext('Delivery time')
        self.find_css(new)
        self.information_name('name_en-GB', Title_en)
        self.information_name('name_th-TH', Title_th)
        self.information_name('days', Days)
        self.find_css(save_close)
        self.check_file(Title_en)
        driver.quit()
    def Order_status_check_Add(self):
        'Add Order status'
        driver = self.driver
        self.Options()
        self.case = self.Order_status_check_Add.__doc__
        self.find_linktext('Order status')
        self.find_css(new)
        self.information_name('name_en-GB', status_Title_en)
        self.information_name('name_th-TH', status_Title_th)
        self.information_name('status_code', status_Code)
        self.find_css(save_close)
        self.check_file(status_Title_en)
        driver.quit()
    def Country_check_Add(self):
        'Add Country list'
        driver = self.driver
        self.Options()
        self.case = self.Country_check_Add.__doc__
        self.find_linktext('Country list')
        self.find_css(new)
        self.find_css('tr:nth-child(1) input')
        self.information_name('name_en-GB', Country_Title_en)
        self.information_name('name_th-TH', Country_Title_th)
        self.information_name('country_code', Country_Code)
        self.information_name('country_code_2', Country_Code2)
        self.find_css(save_close)
        self.check_file(Country_Title_en)
        driver.quit()
    def Province_check_Add(self):
        'Add Province'
        driver = self.driver
        self.Options()
        self.case = self.Province_check_Add.__doc__
        self.find_linktext('Province')
        self.find_css(new)
        self.information_name('PROVINCE_CODE', Province_Code)
        self.information_name('PROVINCE_NAME_en-GB', Province_Name_en)
        self.information_name('PROVINCE_NAME_th-TH', Province_Name_th)
        self.find_css(save_close)
        self.Dropdown('list[limit]', 'All')
        self.check_file(Province_Name_en)
        driver.quit()
    def Amphur_check_Add(self):
        'Add Amphur'
        driver = self.driver
        self.Options()
        self.case = self.Amphur_check_Add.__doc__
        self.find_linktext('Amphur')
        self.find_css(new)
        self.find_css('a.chzn-single > span')
        self.find_css('.active-result:nth-child(%s)' % ProvinceName)
        # self.find("//li[%s]" % ProvinceName)
        self.information_name('AMPHUR_CODE', AmphurCode)
        self.information_name('AMPHUR_NAME_en-GB', AmphurName_en)
        self.information_name('AMPHUR_NAME_th-TH', AmphurName_th)
        self.information_name('POSTCODE', Postcode)
        self.find_css(save_close)
        self.Dropdown('list[limit]', 'All')
        self.check_file(AmphurName_en)
        driver.quit()
    def District_check_Add(self):
        'Add District'
        driver = self.driver
        self.Options()
        self.case = self.District_check_Add.__doc__
        self.find_linktext('District')
        self.find_css(new)
        self.find_css('a.chzn-single > span')
        self.find_css('.active-result:nth-child(%s)' % District_ProvinceName)
        # self.find("//li[%s]" % District_ProvinceName)
        time.sleep(5)
        self.find_css("#AMPHUR_ID_chzn span")
        # self.find_css('.result-selected:nth-child(%d)' % District_AmphurName)
        self.xpath_click("//tr[2]/td[2]/div/div/ul/li[%s]" % District_AmphurName)
        # self.driver.find_element_by_xpath("//tr[2]/td[2]/div/div/ul/li[%s]" % District_AmphurName).click()
        # self.find("//tr[2]/td[2]/div/div/ul/li[%s]" % District_AmphurName)
        self.information_name('DISTRICT_CODE', Districtcode)
        self.information_name('DISTRICT_NAME_en-GB', DistrictName_en)
        self.information_name('DISTRICT_NAME_th-TH', DistrictName_th)
        self.find_css(save_close)
        self.Dropdown('list[limit]', 'All')
        self.check_file(DistrictName_en)
        driver.quit()
    def Attributes_check_Add(self):
        'Add Attributes'
        driver = self.driver
        self.Options()
        self.case = self.Attributes_check_Add.__doc__
        self.find_linktext('Attributes')
        self.find_css(new)
        self.information_name('name_en-GB', Attributes_Title_en)
        self.information_name('name_th-TH', Attributes_Title_th)
        self.Dropdown('attr_type', Type)
        element1 = self.driver.find_element_by_id("independent0")
        element2 = self.driver.find_element_by_id("1")
        self.driver.execute_script("arguments[%s].click();" % Dependent, element1, element2)
        element3 = self.driver.find_element_by_name("allcats")
        element4 = self.driver.find_element_by_id("allcats0")
        self.driver.execute_script("arguments[%s].click();" % Show_for_categories, element3, element4)
        if Show_for_categories == "1":
            self.find_css("option:nth-child(%s)" % category_No)
        self.find_css(save_close)
        self.check_file(Attributes_Title_en)
        driver.quit()

    def Free_attributes_check_Add(self):
        'Add Free attributes'
        driver = self.driver
        self.Options()
        self.case = self.Free_attributes_check_Add.__doc__
        self.find_linktext('Free attributes')
        self.find_css(new)
        self.information_name('name_en-GB', Free_attributes_Title_en)
        self.information_name('name_th-TH', Free_attributes_Title_th)
        self.information_name('description_en-GB', Free_attributes_description_en)
        self.information_name('description_th-TH', Free_attributes_description_th)
        self.find_css('input:nth-child(2)')
        self.find_css(save_close)
        self.check_file(Free_attributes_Title_en)
        driver.quit()

    def Units_of_measure_check_Add(self):
        'Units of measure'

        driver = self.driver
        self.Options()
        self.case = self.Units_of_measure_check_Add.__doc__
        self.find_linktext('Units of measure')
        self.find_css(new)
        self.information_name('name_en-GB', unit_en)
        self.information_name('name_th-TH', unit_th)
        self.find_css(save_close)
        self.check_file(unit_en)
        driver.quit()


    def User_groups_check_Add(self):
        'Add User groups'
        driver = self.driver
        self.Options()
        self.case = self.User_groups_check_Add.__doc__
        self.find_linktext('User groups')
        self.find_css(new)
        self.information_name('name_en-GB', Usergroups_Title_en)
        self.information_name('name_th-TH', Usergroups_Title_th)
        self.information_name('usergroup_discount', Discount)
        self.find(Toggle)
        self.information_name('description1', Description_en)
        self.find("//form[@id='adminForm']/div/fieldset/table/tbody/tr[7]/td[2]/div/div[2]/div/a")
        self.information_name('description2', Description_th)
        self.find_css(save_close)
        self.check_file(Usergroups_Title_en)
        driver.quit()
    def Product_comments_check_Add(self):
        'Add Product comments'
        driver = self.driver
        self.Options()
        self.case = self.Product_comments_check_Add.__doc__
        self.find_linktext('Product comments')
        self.find_css(new)
        self.information_name('product_id', prodoct_ID)
        self.information_name('user_name', Productuser)
        self.information_name('user_email', Productemail)
        self.information_name('review', comment)
        self.find_css(save_close)
        time.sleep(5)
        driver.quit()
    def Product_labels_check_Add(self):
        'Add Product labels'
        driver = self.driver
        self.Options()
        self.case = self.Product_labels_check_Add.__doc__
        self.find_linktext('Product labels')
        self.find_css(new)
        self.information_name('name_th-TH', name_th)
        self.information_name('name_en-GB', name_en)
        self.find_css(save_close)
        self.check_file(name_en)
        driver.quit()
    def Product_Characteristics_check_Add(self):
        'Add Product Characteristics'
        driver = self.driver
        self.Options()
        self.case = self.Product_Characteristics_check_Add.__doc__
        self.find_linktext('Product Characteristics')
        self.find_css(new)
        self.information_name('name_en-GB', P_C_Title_en)
        self.information_name('name_th-TH', P_C_Title_th)
        self.information_name('description_en-GB', P_C_description_en)
        self.information_name('description_th-TH', P_C_description_th)
        self.find_css(P_C_Show_categories)
        if P_C_Show_categories == '#allcats0':
            self.find_css('#category_id > option:nth-child(%d)' % P_C_categories)
        self.find_css(Type_List)
        self.find_css(save_close)
        self.check_file(P_C_Title_en)
        driver.quit()
    def Languages_check_Add(self):
        'check Languages'
        driver = self.driver
        self.Options()
        self.case = self.Languages_check_Add.__doc__
        self.find_linktext('Languages')
        self.box(1, 2)
        self.box(2, 2)
        self.find_css(Unpublic)
        self.box(1, 2)
        self.box(2, 2)
        self.find_css(Public)
        driver.quit()
    def Import_Export_check_Add(self):
        'Add Import & Export'
        driver = self.driver
        self.Options()
        self.case = self.Import_Export_check_Add.__doc__
        self.find_linktext('Import & Export')
        self.find("//a[contains(.,'%s')]" % file)
        self.information_name('params[filename]', file_name)
        self.find_css(save_close)
        self.find("//a[contains(.,'%s')]" % file)
        self.check_file(file_name)
        driver.quit()
    def Addons_check_Add(self):
        'Add Addons'
        driver = self.driver
        self.Options()
        self.case = self.Addons_check_Add.__doc__
        self.find_linktext('Addons')

        driver.quit()

    def Statistic_check_Add(self):
        'check Statistic'
        driver = self.driver
        self.Options()
        self.case = self.Statistic_check_Add.__doc__
        self.find_linktext('Statistic')
        time.sleep(4)
        driver.quit()
    def About_us_check_Add(self):
        'Click About us check'
        driver = self.driver
        self.openwed_Login(pw1,self.base_url,self.username,self.pwd)
        self.case = self.About_us_check_Add.__doc__
        self.menu_MooZiiCart('About us')
        driver.quit()

    def Create_Account_check_Add(self):
        'Add Create_Account'
        driver = self.driver
        self.driver.get(wed1)
        self.case = self.Create_Account_check_Add.__doc__
        self.find_linktext('Create an account')

        self.information_name('jform[name]',cneme)
        self.information_name('jform[username]',cusername)
        self.information_name('jform[password1]',cpassword)
        self.information_name('jform[password2]',cpassword)
        self.information_name('jform[email1]',cemail)
        self.information_name('jform[email2]',cemail)
        self.find_css('.validate')
        driver.quit()
    def Home_Category_check_Add(self):
        'Click Category'
        driver = self.driver
        self.openwed_Login(pw2,wed1,user2,password2)
        self.find_linktext('Shop')
        self.case = self.Home_Category_check_Add.__doc__
        self.find_linktext(Category)
        driver.quit()
    def Home_Product_check_Add(self):
        'Click Product'
        driver = self.driver
        self.openwed_Login(pw2,wed1,user2,password2)
        self.find_linktext('Shop')
        self.find_linktext(Category)
        self.case = self.Home_Product_check_Add.__doc__
        self.find_linktext(Product)
        driver.quit()
    def Home_Cart_check_Add(self):
        'Cart'
        driver = self.driver
        driver.get(wed1)
        self.find_linktext('Shop')
        self.find_linktext(Category)
        # self.find_linktext(Product)
        # self.find_css('.btn-buy')
        self.case = self.Home_Cart_check_Add.__doc__
        self.menu_buy(1)
        self.find_css(Back_to_shop)
        self.menu_buy(2)
        self.information_name('quantity[0]', '2')
        self.information_name('quantity[1]', '2')
        self.find_css(Update_cart)
        self.information_css(information_css,"300")
        self.find_css(Activate)
        self.find("(//img[@alt='Delete'])[%d]" % Delete)
        self.Confirm()
        self.find_linktext('Checkout')

        self.information_name('username',user2)
        self.information_css('#jlpassword',password2)
        self.find_css('.button')
        self.Dropdown('title',Title)
        self.information_name('f_name', First_name)
        self.information_name('l_name', Last_name)
        self.information_name('email',Email)
        self.information_name('street', Street_No)
        self.information_name('zip', Postal_Code)
        self.information_name('city', City)
        self.Dropdown('country',Country)
        self.information_name('phone',phone)
        self.find_css('.button')
        self.find_css('#payment_method_%d' % payment)
        self.find_css('.button')
        self.find_css(Standard)# Standard , Express
        self.find_css('.button')
        self.find_css('#agb')
        self.find_css('.button')
        time.sleep(5)
        driver.quit()


 


class test01_check_Add(MooZiiCart_check):

    def test01(self):
        self.categories_check_Add()



ย้อนกลับไปยัง

ผู้ใช้งานขณะนี้

กำลังดูบอร์ดนี้: 19 และ บุคคลทั่วไป 0 ท่าน