Skip to content

Conversation

@ionutcatana
Copy link
Contributor

Description

I refactored the Tab.xpath method to catch and ignore the TimeoutError exceptions thrown by the Tab.find_all method that it utilizes. This fixes #218

6 tests do fail, but they don't utilize the Tab.xpath method in any way. These are the failing tests:

FAILED tests/bot_detection/test_browserscan.py::test_browserscan[headless0] - AssertionError: assert 'Robot' == 'Normal'
FAILED tests/bot_detection/test_browserscan.py::test_browserscan[headless1] - AssertionError: assert 'Robot' == 'Normal'
FAILED tests/core/test_browser.py::test_update_target_sets_target_title[headless0] - AssertionError: assert 'example.com' == 'Example Domain'
FAILED tests/core/test_browser.py::test_update_target_sets_target_title[headless1] - AssertionError: assert 'example.com' == 'Example Domain'
FAILED tests/core/test_multiple_browsers.py::test_multiple_browsers_diff_userdata - AssertionError: assert 'example.com/one' == 'Example Domain'
FAILED tests/docs/tutorials/test_infinite_scrolling_tutorial.py::test_infinite_scrolling_tutorial_3[headless1] - AssertionError: Calls not found.

Pre-merge Checklist

  • I have described my change in the section above.
  • I have ran the ./scripts/format.sh and ./scripts/lint.sh scripts. My code is properly formatted and has no linting errors.
  • I have ran uv run pytest and ensured all tests pass.
  • I have added my change to CHANGELOG.md under the [Unreleased] section.

@ionutcatana ionutcatana requested a review from a team as a code owner October 15, 2025 20:26
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
zendriver/core/tab.py 62.50% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@stephanlensky stephanlensky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wonder if the tests failing we're just an issue on your local machine, everything looks good here 🙂

Thanks for the contribution!

@stephanlensky stephanlensky merged commit 9ecfa50 into cdpdriver:main Oct 19, 2025
4 of 5 checks passed
loop = asyncio.get_running_loop()
loop = asyncio.get_running_loop()
while not items:
start_time = loop.time()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is merged already, but shouldn't the start_time = loop.time() be outside of the while loop? Did I misunderstand the change?
I would also merge the await self.sleep(0.1) into the find_all call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original implementation may have been copied directly from nodriver, bugs included.

Definitely feel free to PR some fixes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab.xpath raises TimeoutError

3 participants