From f7db1c52efb7b64f6147fe3af6ef873f0aed29ea Mon Sep 17 00:00:00 2001 From: NguyenHoang9172 Date: Sat, 11 Oct 2025 11:17:27 +0700 Subject: [PATCH] Upload all homework Python --- hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai1.py | 0 hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai2.py | 0 hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai3.py | 0 hanh-nguyen/BT_Buoi8.2/Bai1.py | 31 ++++++++++++++++++ hanh-nguyen/BT_Buoi8.2/Bai2.py | 17 ++++++++++ .../__pycache__/employee.cpython-313.pyc | Bin 0 -> 1355 bytes 6 files changed, 48 insertions(+) rename hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai1.py (100%) rename hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai2.py (100%) rename hanh-nguyen/{BT_Buoi8 => BT_Buoi8.1}/Bai3.py (100%) create mode 100644 hanh-nguyen/BT_Buoi8.2/Bai1.py create mode 100644 hanh-nguyen/BT_Buoi8.2/Bai2.py create mode 100644 hanh-nguyen/__pycache__/employee.cpython-313.pyc diff --git a/hanh-nguyen/BT_Buoi8/Bai1.py b/hanh-nguyen/BT_Buoi8.1/Bai1.py similarity index 100% rename from hanh-nguyen/BT_Buoi8/Bai1.py rename to hanh-nguyen/BT_Buoi8.1/Bai1.py diff --git a/hanh-nguyen/BT_Buoi8/Bai2.py b/hanh-nguyen/BT_Buoi8.1/Bai2.py similarity index 100% rename from hanh-nguyen/BT_Buoi8/Bai2.py rename to hanh-nguyen/BT_Buoi8.1/Bai2.py diff --git a/hanh-nguyen/BT_Buoi8/Bai3.py b/hanh-nguyen/BT_Buoi8.1/Bai3.py similarity index 100% rename from hanh-nguyen/BT_Buoi8/Bai3.py rename to hanh-nguyen/BT_Buoi8.1/Bai3.py diff --git a/hanh-nguyen/BT_Buoi8.2/Bai1.py b/hanh-nguyen/BT_Buoi8.2/Bai1.py new file mode 100644 index 0000000..683fd78 --- /dev/null +++ b/hanh-nguyen/BT_Buoi8.2/Bai1.py @@ -0,0 +1,31 @@ +from abc import ABC, abstractmethod +class BaseElement(ABC): + def __init__(self, locator): + self.__locator = locator + + def get_locator(self): + return self.__locator + + @abstractmethod + def click(self): + pass + +class Button(BaseElement): + def click(self): + locator = self.get_locator() + print(f"Clicking on a button with {locator}.") + +class Checkbox(BaseElement): + def click(self): + locator = self.get_locator() + print(f"Toggling a checkbox with {locator}") + + def is_selected(self): + print("Checking selection status....") + +button = Button("add_to_wishlist") +checkbox = Checkbox("marketing_subscription") + +button.click() +checkbox.click() +checkbox.is_selected() \ No newline at end of file diff --git a/hanh-nguyen/BT_Buoi8.2/Bai2.py b/hanh-nguyen/BT_Buoi8.2/Bai2.py new file mode 100644 index 0000000..044597f --- /dev/null +++ b/hanh-nguyen/BT_Buoi8.2/Bai2.py @@ -0,0 +1,17 @@ +class Browser: + @staticmethod + def get_driver(browser_name): + if browser_name == "chrome": + print("Initializing Chrome Driver...") + return("ChromeDriver object") + elif browser_name == "firefox": + print("Initializing Firefox Driver...") + return("FirefoxDriver object") + else: + raise ValueError("Browser không được hỗ trợ") + +browser1 = "chrome" +Browser.get_driver(browser1) + +browser2 = "edge" +Browser.get_driver(browser2) \ No newline at end of file diff --git a/hanh-nguyen/__pycache__/employee.cpython-313.pyc b/hanh-nguyen/__pycache__/employee.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12af81965ce05f6485748ba972a5d056e02fd55a GIT binary patch literal 1355 zcmZ8g&x;&I6n<6xV|r(I%>J5n*#vDi64Ia{2Nxk|@SqpPA=p_Mu#=+G+nH(U>Dg5G zB+hL_SXVT#mxcTXlK;W~z>`E_ExZIzdrRy{a`e6G?%80$eEnX%H?O{W@2j%YX#=k1 zOHYSCGl0LzX_i$R!0;co-TQC)n>Gi*03NfR$Ca6d zqge4|&oh*n$LU?!!c6HPdXM@YiDJ zXywNbPS(253|Lx|G)<4|!n!X#uSNHxp5gu4LX5_Hla%ZwA?{7Ww2qt;;%*}IB2BV5 z8w(*9v5;IwP+cMNA}o?fghe5fJCh>Lg?J45EKOKa-!;%Bbh{4VAI`1rzYe!Hszk~; z#UJz{!e-TyhVnA*-2R`GcHw$o6ah) zB3x&$596k}3%Brf^;esh;X?mv+E74=Nop+$%gQJFvD8gaRvO=rQ_s?4Iuo0G3scpC z5K$WD*pQr_EsD>bRXrhM>RiQgE+?9M-bHwYqjNexw0?6oAFcoHY@c+u9=5CLFHuEiRL+-xP)&v6 z%I@h$k^G8%Q~Zl*azKXd$5}F#NQBy{oaV{snu^CG#qUMR+LuXIXr;(EG4D(j%K5Mo z+jZ$-KuhB@G@coZv6sBXHl71Qxe9Fg1vl9F!~P4v&+|6eZyXLE8BeSWGybQwc=*ZD b#iMVYSniBJ1#5Qa`_Z?f@5X;XC9MAdaHtNn literal 0 HcmV?d00001