diff --git a/CHANGELOG.md b/CHANGELOG.md index d127360..f17dd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.1.2] - 2022-06-03 + +### Added +- Fix xpaths to allow checkout completion + ## [4.1.1] - 2022-05-27 ### Added @@ -111,6 +116,8 @@ can continue as normal project running locally. Suitable for users who are not looking forward to contribute. +[4.1.2]: + https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.2 [4.1.1]: https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.1 [4.1.0]: diff --git a/pyproject.toml b/pyproject.toml index 4cd391a..fee30f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "automatic-udemy-course-enroller-get-paid-udemy-courses-for-free" -version = "4.1.1" +version = "4.1.2" description = "" authors = [""] @@ -24,7 +24,7 @@ pytest-asyncio = "^0.18.3" bumpver = "^2022.1116" [tool.bumpver] -current_version = "4.1.1" +current_version = "4.1.2" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "Bump version {old_version} -> {new_version}" commit = true diff --git a/setup.py b/setup.py index ee0e4fe..8d9f03e 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="udemy-enroller", - version="4.1.1", + version="4.1.2", long_description=long_description, long_description_content_type="text/markdown", author="aapatre", diff --git a/udemy_enroller/udemy_ui.py b/udemy_enroller/udemy_ui.py index 1f45c49..a7c34f9 100644 --- a/udemy_enroller/udemy_ui.py +++ b/udemy_enroller/udemy_ui.py @@ -174,9 +174,7 @@ def enroll(self, url: str) -> str: WebDriverWait(self.driver, 10).until(element_present).click() # Enroll Now 2 - enroll_button_xpath = ( - "//div[contains(@class, 'styles--checkout-pane-outer')]//button" - ) + enroll_button_xpath = "//div[starts-with(@class, 'checkout-button--checkout-button--container')]//button" element_present = EC.presence_of_element_located( ( By.XPATH, @@ -258,7 +256,9 @@ def enroll(self, url: str) -> str: return UdemyStatus.ALREADY_ENROLLED.value def _check_enrolled(self, course_name): - add_to_cart_xpath = "//div[@data-purpose='add-to-cart']" + add_to_cart_xpath = ( + "//div[starts-with(@class, 'buy-box')]//div[@data-purpose='add-to-cart']" + ) add_to_cart_elements = self.driver.find_elements_by_xpath(add_to_cart_xpath) if not add_to_cart_elements or ( add_to_cart_elements and not add_to_cart_elements[0].is_displayed() @@ -315,7 +315,7 @@ def _check_categories(self, course_identifier): def _check_price(self, course_name): course_is_free = True - price_xpath = "//div[contains(@class, 'styles--checkout-pane-outer')]//span[@data-purpose='total-price']//span" + price_xpath = "//div[contains(@data-purpose, 'total-amount-summary')]//span[2]" price_element = self.driver.find_element_by_xpath(price_xpath) # We are only interested in the element which is displaying the price details @@ -340,7 +340,9 @@ def _check_price(self, course_name): # Get the listed price of the course for stats if course_is_free: - list_price_xpath = "//div[contains(@class, 'styles--checkout-pane-outer')]//td[@data-purpose='list-price']//span" + list_price_xpath = ( + "//div[starts-with(@class, 'order-summary--original-price-text')]//span" + ) list_price_element = self.driver.find_element_by_xpath(list_price_xpath) list_price = Price.fromstring(list_price_element.text) if list_price.amount is not None: