Replace `click_selector` by `wait_for,` which is a selector that we must wait for before considering the page loaded. Also added `select_wait_for`, which returns the waited for element. Oddly this may be needed in some case (such as `artifactory.py`) where the `page.content()` does not contain the waited for element.
21 lines
947 B
Python
21 lines
947 B
Python
from bs4 import BeautifulSoup
|
|
from common import dates, http
|
|
from common.releasedata import ProductData, config_from_argv
|
|
|
|
"""Fetches Artifactory versions from https://jfrog.com, using requests_html because JavaScript is
|
|
needed to render the page."""
|
|
|
|
config = config_from_argv()
|
|
with ProductData(config.product) as product_data:
|
|
# Oddly the full page content does not contain the versions, must use the wait_for element directly.
|
|
content = http.fetch_javascript_url(config.url, wait_for='div.informaltable', select_wait_for=True)
|
|
soup = BeautifulSoup(content, 'html.parser')
|
|
|
|
for row in soup.select('.informaltable tbody tr'):
|
|
cells = row.select("td")
|
|
if len(cells) >= 2:
|
|
version = cells[0].text.strip()
|
|
if version:
|
|
date_str = cells[1].text.strip().replace("_", "-").replace("Sept-", "Sep-")
|
|
product_data.declare_version(version, dates.parse_date(date_str))
|