HENNGE / arsenic

Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Other
349 stars 52 forks source link

Any way to avoid close chrome after execution #148

Closed DiMiTriFrog closed 2 years ago

DiMiTriFrog commented 2 years ago

I need any way to keep the browser opened after code execution will finished.

Et9797 commented 2 years ago

To do this instead of get_session() I used start_session(). This will leave the drivers running however: to kill the drivers os.system("taskkill /f /im chromedriver/msedgedriver.exe") on Windows.

DiMiTriFrog commented 2 years ago

Hi! Thanks for the response. I tried it but browser opens but isn't loading any.

Et9797 commented 2 years ago

@DiMiTriFrog Should work. Make sure to import services and browser

from arsenic.services import Chromedriver
from arsenic.browsers import Chrome
service = Chromedriver()
browser = Chrome()
session = await start_session(service, browser)
await session.get("https://google.com")

now you can pass on the session object variable to other functions

DiMiTriFrog commented 2 years ago

So right! I reboot my pc, so tests with chromedrivers.

Thanks so much, is working for me.