diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92b2bdc..49173cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,16 +40,10 @@ jobs: browser: "edge" steps: - - uses: actions/checkout@v2 - - name: Install libgl1 - if: runner.os == 'Linux' - run: | - sudo dpkg --add-architecture i386 - sudo apt update - sudo apt install libgl1-mesa-dev libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2 -y + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 555f1d7..42ca952 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -13,12 +13,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.7] + python-version: [3.12] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index ef81aa9..88db1d5 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -8,13 +8,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Install pypa/build run: >- python -m @@ -30,6 +30,6 @@ jobs: . - name: Publish distribution to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/botcity/web/browsers/chrome.py b/botcity/web/browsers/chrome.py index 1782533..bf24877 100644 --- a/botcity/web/browsers/chrome.py +++ b/botcity/web/browsers/chrome.py @@ -132,9 +132,11 @@ def wait_for_downloads(driver): """ if not driver.current_url.startswith("chrome://downloads"): driver.get("chrome://downloads/") + # Chrome changed the `e.state` from a ENUM Str to numbers. Here 2 means COMPLETE. + # Reference: https://shorturl.at/G4EES return driver.execute_script(""" var items = document.querySelector('downloads-manager') .shadowRoot.getElementById('downloadsList').items; - if (items.every(e => e.state === "COMPLETE")) + if (items.every(e => e.state === 2)) return items.map(e => e.fileUrl || e.file_url); """) diff --git a/botcity/web/browsers/undetected_chrome.py b/botcity/web/browsers/undetected_chrome.py index c06947f..0b2c359 100644 --- a/botcity/web/browsers/undetected_chrome.py +++ b/botcity/web/browsers/undetected_chrome.py @@ -138,9 +138,11 @@ def wait_for_downloads(driver): """ if not driver.current_url.startswith("chrome://downloads"): driver.get("chrome://downloads/") + # Chrome changed the `e.state` from a ENUM Str to numbers. Here 2 means COMPLETE. + # Reference: https://shorturl.at/G4EES return driver.execute_script(""" var items = document.querySelector('downloads-manager') .shadowRoot.getElementById('downloadsList').items; - if (items.every(e => e.state === "COMPLETE")) + if (items.every(e => e.state === 2)) return items.map(e => e.fileUrl || e.file_url); """) diff --git a/botcity/web/tests/__init__.py b/botcity/web/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/botcity/web/tests/test_import.py b/botcity/web/tests/test_import.py deleted file mode 100644 index 1d13474..0000000 --- a/botcity/web/tests/test_import.py +++ /dev/null @@ -1,3 +0,0 @@ -def test_package_import(): - import botcity.web as web - assert web.__file__ != "" diff --git a/requirements.txt b/requirements.txt index 9b161ce..06838e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ botcity-framework-base>=0.2.2 beautifulsoup4 -numpy<2 +numpy opencv-python pillow selenium>=4.10,<5 undetected-chromedriver -packaging \ No newline at end of file +packaging diff --git a/tests/test_browser.py b/tests/test_browser.py index b95512b..e65d218 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -215,7 +215,7 @@ def test_get_view_port_size(web: WebBot): element = [width, height] else: element = web.find_element('window-size', By.ID).text.split('x') - sizes = [tuple(int(e) for e in element), (1600, 900), (1176, 802)] + sizes = [tuple(int(e) for e in element), (1600, 900), (1176, 802), (1600, 987)] assert size in sizes