Last active
November 30, 2017 00:18
-
-
Save mchlmicy/a17bc7fe345736c7f61c54df12210fa0 to your computer and use it in GitHub Desktop.
Reusable Selenium browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # data types | |
| import time | |
| # webdriver | |
| from selenium import webdriver | |
| def create(): | |
| client = webdriver.Firefox() | |
| specs = {'url': client.command_executor._url, 'session_id': client.session_id} | |
| print(specs) | |
| return specs | |
| client_specs = create() | |
| def connect(): | |
| time.sleep(3) | |
| client = webdriver.Remote(command_executor=client_specs['url'], desired_capabilities={}) | |
| client.session_id = client_specs['session_id'] | |
| client.get('https://google.com') | |
| connect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment