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 0000000..12af819 Binary files /dev/null and b/hanh-nguyen/__pycache__/employee.cpython-313.pyc differ