Skip to content

Commit 79b9b8a

Browse files
Rename modules, improve CLI output, rename entry point
Co-authored-by: Bartosz <[email protected]>
1 parent 67f6d93 commit 79b9b8a

File tree

11 files changed

+24
-13
lines changed

11 files changed

+24
-13
lines changed

python-selenium/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ dependencies = [
1515
"selenium",
1616
]
1717
[project.scripts]
18-
bandcamp-player = "bandcamp.__main__:main"
18+
discover = "bandcamp.__main__:main"

python-selenium/src/bandcamp/app/player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from selenium.webdriver import Firefox
22
from selenium.webdriver.firefox.options import Options
33

4-
from bandcamp.web.page import DiscoverPage
4+
from bandcamp.web.pages import DiscoverPage
55

66
BANDCAMP_DISCOVER_URL = "https://bandcamp.com/discover/"
77

python-selenium/src/bandcamp/app/tui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def display_tracks(player):
6161
"""Display information about the currently playable tracks."""
6262
header = f"{'#':<5} {'Album':<{CW}} {'Artist':<{CW}} {'Genre':<{CW}}"
6363
print(header)
64-
print("-" * 100)
64+
print("-" * 80)
6565
for track_number, track_element in enumerate(
6666
player.tracklist.available_tracks, start=1
6767
):

python-selenium/src/bandcamp/web/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import dataclass
2+
from pprint import pformat
23

34
from selenium.webdriver.remote.webdriver import WebDriver
45
from selenium.webdriver.remote.webelement import WebElement
@@ -15,6 +16,9 @@ class Track:
1516
genre: str
1617
url: str
1718

19+
def __str__(self):
20+
return pformat(self)
21+
1822

1923
class WebPage:
2024
def __init__(self, driver: WebDriver) -> None:
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from selenium.webdriver.remote.webdriver import WebDriver
33

44
from bandcamp.web.base import WebPage
5-
from bandcamp.web.element import TrackListElement
5+
from bandcamp.web.elements import TrackListElement
66
from bandcamp.web.locators import DiscoverPageLocator
77

88

python-selenium/training/communication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from selenium.webdriver.common.by import By
66

77
driver = webdriver.Firefox() # Run in normal mode
8+
driver.implicitly_wait(5)
9+
810
driver.get("https://bandcamp.com/discover/")
911

1012
# Accept cookies, if required

python-selenium/training/interaction.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
options = Options()
88
options.add_argument("--headless")
99
driver = webdriver.Firefox(options=options)
10+
driver.implicitly_wait(5)
11+
1012
driver.get("https://bandcamp.com/discover/")
1113

1214
tracks = driver.find_elements(By.CLASS_NAME, "results-grid-item")

python-selenium/training/navigation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
options = Options()
66
options.add_argument("--headless")
77
driver = webdriver.Firefox(options=options)
8+
driver.implicitly_wait(5)
89

910
driver.get("https://bandcamp.com/discover/")
1011
print(driver.title)

python-selenium/training/observation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
options = Options()
99
options.add_argument("--headless")
1010
driver = webdriver.Firefox(options=options)
11+
driver.implicitly_wait(5)
12+
1113
driver.get("https://bandcamp.com/discover/")
1214

1315
tracks = driver.find_elements(By.CLASS_NAME, "results-grid-item")

0 commit comments

Comments
 (0)