Closed zw963 closed 7 months ago
For describe more clearly, If consider show source code is better, following is a example:
i use create_driver method for create a new driver.
this method return new created driver and capabilities here
Then, create_session method accept above, return new created session, those create session process run synchronously in fiber, as you can see here, to visit several website to get result, i have to session.delete
and driver.stop
after all done.
those code works, and performance is much better than initialize version, my question(issue) is, is it possible make it more quickly? e.g. keep driver in memory, never stop it?
Thanks
A better explain, again!
It would be absolutely awesome if Chrome was able to start in kind of a "daemon"/background mode, waiting for requests to render some content, without needing to start a new process for each page render, selenium must be able to find processes that exist
Can we do like this?
Okay, fine, i thought i misunderstood and misuse this shards, the answer code is post in https://github.com/crystal-loot/selenium.cr/issues/43#issue-2060174625
I guess what i really want is not reuse exists session, i admit that I may not have a clear understanding of many concepts yet, but it seems to be a little better since those days, what i want is (we assume not use headless mode), a chrome browser process keep resident in the memory, which probably make open a new session more quickly then before, as we are doing browse use our browser, open a new tab and visit a site always quicker than close browser, then reopen browser visit same site, right?
Okay, compare to current headless mode, i guess this should be, create a chromedriver(with Capabilities), and keep it resident in the memory, then create a new session and visit site, then
session.delete
, repeatedly.If this time i am not understood wrong, what i expect is, reuse a exists chrome driver, right?
I guess, this time, my question is:
current we use
driver = Selenium::Driver.for(:chrome, service: service)
for create a driver, thendriver.stop
after use it, is there possible to not terminate created driver, instead, always reuse exists driver?Please point me out if this is not necessary completely, or, i am wrong, again?
Thanks.
Originally posted by @zw963 in https://github.com/matthewmcgarvey/selenium.cr/issues/24#issuecomment-1542497195