-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add splinter.Config, deprecate many browser arguments (#1134)
- Loading branch information
Showing
21 changed files
with
343 additions
and
157 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.. Copyright 2023 splinter authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
.. meta:: | ||
:description: Config | ||
:keywords: splinter, python, tutorial, config | ||
|
||
++++++ | ||
Config | ||
++++++ | ||
|
||
.. module:: splinter.config | ||
|
||
.. autoclass:: Config | ||
:members: |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
:hidden: | ||
|
||
browser | ||
config | ||
finding | ||
elements-in-the-page | ||
mouse-interaction | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Optional | ||
|
||
|
||
@dataclass | ||
class Config: | ||
"""Standard interface for basic and nearly universal driver flags. | ||
The primary purpose of Config is to reduce the burden on the user to import | ||
Selenium Options objects for common operations. The second purpose is to | ||
avoid argument bloat and drift for the various drivers. | ||
Both Splinter Config and Selenium Options can be used together. | ||
Config will override Options, if applicable. | ||
Config is not a complete replacement for Selenium Options. | ||
For unique and esoteric functionality that is exclusive to one web browser, | ||
Selenium Options should still be used. The purpose of Config is to expose | ||
a universal interface for common functionality, not try to capture all | ||
of it. | ||
Example: | ||
>>> from splinter import Browser, Config | ||
>>> | ||
>>> | ||
>>> my_config = Config(fullscreen=True) | ||
>>> my_browser = Browser(config=my_config) | ||
Attributes: | ||
extensions: Add extensions to the browser. | ||
The full path to each extension must be included. | ||
When the browser is closed extensions will be deleted from | ||
the profile, even if the profile is not a temporary one. | ||
fullscreen: Launch the browser in fullscreen mode. | ||
headless: Launch the browser in headless mode. | ||
Requires Chrome 59+ or Firefox 55+. | ||
incognito: Launch the browser in incognito mode. | ||
user_agent: Set a custom user_agent. | ||
""" | ||
extensions: Optional[List[str]] = None | ||
fullscreen: Optional[bool] = False | ||
headless: Optional[bool] = False | ||
incognito: Optional[bool] = False | ||
user_agent: Optional[str] = "" |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.