Skip to content

ChromePy creates only one Chrome and multiples ChromeRemotes

License

Notifications You must be signed in to change notification settings

matheusvanzan/chromepy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChromePy

ChromePy makes it possible to create just one Google Chrome instance and multiple ChromeRemote remote controllers. It avoids opening multiple Chrome instances as it can be very resource consuming.

ChromePy

The workflow is as simple as:

  • Chrome creates a Selenium Chrome Driver instance and saves session data on a text file.
  • ChromeRemote uses this session data to create a Selenium Remote instance and control the same browser driver.

Install

Just install from pip

pip install ChromePy

Usage

To start a Chrome instance

from chromepy.chrome import Chrome

chrome = Chrome.instance
chrome.get('https://google.com')

print('Chrome running at ', chrome.current_url)
print(chrome.command_executor._url, chrome.session_id)
input('Press any key to quit chrome...')
chrome.quit()

To start Remote instances. Remember not to call remote.quit() as it will kill the chrome instance as well.

from chromepy.remote import ChromeRemote

remote1 = ChromeRemote()
print('remote1 url', remote1.current_url)
remote1.get('https://google.com')

remote2 = ChromeRemote()
print('remote2 url', remote2.current_url)

This examples can be found in the examples directory.

About

ChromePy creates only one Chrome and multiples ChromeRemotes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages