Skip to content

Commit

Permalink
Merge pull request #387 from aapatre/develop
Browse files Browse the repository at this point in the history
Release v4.1.2
  • Loading branch information
cullzie authored Jun 3, 2022
2 parents 7554073 + 94e72d3 commit b9325b6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [""]

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 8 additions & 6 deletions udemy_enroller/udemy_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit b9325b6

Please sign in to comment.