This repository contains Python scripts for exporting any Selenium session and import this session back, on another Selenium WebDriver instance.
- Clone the repository:
git clone https://github.com/HugoCls/Import-Export-SeleniumSession
- Install dependencies:
pip install -r requirements.txt
- You can either import the export_session() function into your code or modify export.py file.
from session_exporter import export_session
# ... [Your code] ...
export_session(driver)
# ... [Your code] ...
-
Run
export.py
or[your_script].py
. -
The session data, including cookies and storage information, will be exported to the
session.pkl
file.
-
Change
https://yourwebsite.com
and runimport.py
. -
The script will open a Chrome browser, navigate to your specified website, and import session data from the
session.pkl
file.
This repository is under MIT License, please check it out before using.