Comments (1)
Hello ! I saw that error too.
Here is a simple code to reproduce:
import asyncio
from arsenic import get_session, browsers, services
async def launch_browser():
service = services.Geckodriver()
browser = browsers.Firefox(
acceptInsecureCerts=True,
)
async with get_session(service, browser) as session:
await session.get('http://127.0.0.1:8000/index.php', timeout=5)
page_source = await session.get_page_source()
async def main():
await asyncio.gather(
launch_browser(),
)
asyncio.run(main())
Here the timeout is set to 5 for arsenic. The php script is sleeping for 6 seconds:
<?php
sleep(6);
?>
Traceback:
Traceback (most recent call last):
File "/tmp/headless/arsenic_single_req.py", line 27, in <module>
asyncio.run(main())
File "/usr/lib64/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/tmp/headless/arsenic_single_req.py", line 23, in main
await asyncio.gather(
File "/tmp/headless/arsenic_single_req.py", line 19, in launch_browser
await session.get('http://127.0.0.1:8000/index.php', timeout=5)
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib/python3.10/site-packages/arsenic/session.py", line 152, in get
await self._request(
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib/python3.10/site-packages/arsenic/session.py", line 40, in _request
status, data = await self.connection.request(
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib/python3.10/site-packages/arsenic/connection.py", line 55, in wrapper
return await asyncio.get_event_loop().create_task(func(*args, **kwargs))
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib/python3.10/site-packages/arsenic/connection.py", line 103, in request
async with self.session.request(
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib64/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
self._resp = await self._coro
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib64/python3.10/site-packages/aiohttp/client.py", line 559, in _request
await resp.start(conn)
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib64/python3.10/site-packages/aiohttp/client_reqrep.py", line 893, in start
with self._timer:
File "/home/sirius/.local/share/virtualenvs/headless-C7_0qtPd/lib64/python3.10/site-packages/aiohttp/helpers.py", line 721, in __exit__
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
Also that timeout is not raised after the delay given to the timeout
argument so if the page waits 30 secs the timeout is raised after 30secs, not 5 secs
Behavior seen:
- the timeout parameter given to
session.get
was not used - an asyncio exception (from
asyncio.exceptions
was raised)
Expected behavior:
- a timeout exception is raised as soon as the specified timeout is reached
- an arsenic exception is raised (
ArsenicTimeout
)
Versions used:
- arsenic==21.8
- Python 3.10.6
- geckodriver 0.26.0 (e9783a644016 2019-10-10 13:38 +0000)
- Firefox 104.0 (64 bits)
from arsenic.
Related Issues (20)
- Auth proxy with user and password HOT 12
- get_attribute("innerHTML") stopped working (chrome) HOT 3
- compatibility issue when asyncio loop policy is not the default one HOT 7
- Any way to controle several tabs async? HOT 2
- How to get page title? HOT 1
- arsenic doesnโt support all ChromeOptions? HOT 3
- Unable to open URLs with chrome driver at all? HOT 1
- Unable to set prefs in arsenic similar to selenium (download files to default directory)
- Any way to avoid close chrome after execution HOT 4
- How does this compare to playwright? HOT 1
- AttributeError: 'str' object has no attribute 'fileno' HOT 1
- Spawning Chrome/Edge browser in Windows from WSL2
- Unable to run tests because of broken dependency
- Post-merge CI build fails HOT 2
- Shall we try goodfirstissue.dev ?
- Getting 'unknown error: net::ERR_CONNECTION_CLOSED' Error HOT 4
- Cloudflare detection HOT 1
- No requirements.txt file and couldn't run the tests with Pytest HOT 5
- FileNotFoundError: [WinError 2] The system cannot find the file specified HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arsenic.