Scrapling icon indicating copy to clipboard operation
Scrapling copied to clipboard

linux chrome auto closed?

Open yuyang-ok opened this issue 5 months ago • 3 comments

Have you searched if there an existing issue for this?

  • [x] I have searched the existing issues

Python version (python --version)

Python 3.14.5

Scrapling version (scrapling.version)

"scrapling[all]>=0.4.9"

Dependencies version (pip3 freeze)

sorry I am new to python too.

What's your operating system?

linux debian 6.12.90+deb13.1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.90-2 (2026-05-27) x86_64 GNU/Linux

Are you using a separate virtual environment?

Yes

Expected behavior

is this a bug??? the chrome should always running.

Actual behavior

chrome should running until I close it.

Steps To Reproduce

from scrapling.fetchers import DynamicFetcher
import time

page = DynamicFetcher.fetch('https://baidu.com', headless=False)


time.sleep(1000)

yuyang-ok avatar Jun 11 '26 06:06 yuyang-ok

https://github.com/user-attachments/assets/d30473e1-bc1c-450b-8d51-e46259233ac6

yuyang-ok avatar Jun 11 '26 06:06 yuyang-ok

Hi @yuyang-ok, not a maintainer, but what you're seeing is the expected behavior rather than a bug. The fetch() method opens the browser, loads the page, and then closes everything once it has the result, so the sleep in your script runs after the browser is already gone. If you want the browser to stay open while you work with it, use a session instead, which keeps it running until you leave the block:

from scrapling.fetchers import DynamicSession
import time

with DynamicSession(headless=False) as session:
    page = session.fetch('https://baidu.com')
    time.sleep(1000)

If you just want the page to stay up a bit longer with your original code, you can also pass wait=60000 to fetch() to delay the close by that many milliseconds. Since you mentioned you're new to Python, the project's Discord server linked in the README is a good place to ask questions like this, and I think this issue can probably be closed since everything is working as intended.

yetval avatar Jun 11 '26 07:06 yetval

@yetval thank u

yuyang-ok avatar Jun 11 '26 07:06 yuyang-ok