Skip to content

Commit 39b1642

Browse files
committed
DOC: Update documentation for page load strategy.
1 parent c110ac6 commit 39b1642

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

docs/browsers.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Here is an example on how to do that:
99
```python
1010
from botcity.web import WebBot, Browser
1111

12+
# Page Load Strategy
13+
from botcity.web import PageLoadStrategy
14+
1215
# For Chrome
1316
from botcity.web.browsers.chrome import default_options, default_capabilities
1417
# For Firefox
@@ -24,13 +27,16 @@ class Bot(WebBot):
2427
# Configure whether or not to run on headless mode
2528
self.headless = False
2629

30+
self.page_load_strategy = PageLoadStrategy.NORMAL
31+
2732
# Fetch the default options for my preferred browser
2833
# Pass in the headless, download_folder_path and user_data_dir
2934
# to be used when building the default_options
3035
def_options = default_options(
3136
headless=self.headless,
3237
download_folder_path=self.download_folder_path,
33-
user_data_dir=None # Informing None here will generate a temporary directory
38+
user_data_dir=None, # Informing None here will generate a temporary directory
39+
page_load_strategy=self.page_load_strategy
3440
)
3541

3642
# Add your customized argument
@@ -51,6 +57,14 @@ class Bot(WebBot):
5157
...
5258
```
5359

60+
## Page Load Strategy
61+
62+
Page Load Strategy is a browser option that determines how the browser will load the page.
63+
64+
::: botcity.web.browsers.PageLoadStrategy
65+
rendering:
66+
heading_level: 4
67+
5468
## Specific Browser Modules
5569

5670
Here are the documentation for the methods mentioned above for each of the supported browsers.
@@ -94,4 +108,4 @@ If you have any questions about the driver see [IE Driver Server Documentation](
94108

95109
See the [list of supported arguments in IE](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/hh826025(v=vs.85)).
96110

97-
During execution some errors may occur, [see the list of common errors](https://testguild.com/selenium-webdriver-fix-for-3-common-ie-errors/).
111+
During execution some errors may occur, [see the list of common errors](https://testguild.com/selenium-webdriver-fix-for-3-common-ie-errors/).

docs/intro.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ proper configuration to launch the browser in the desired mode.
111111
and things such as cookies and stored passwords or certificates from one execution won't interfere with
112112
the others.
113113

114+
- **Page Load Strategy**: By default we use the `NORMAL` strategy which waits for the page to load completely.
115+
116+
114117
A handful of other options are also set and they can be inspected on the source code for each browser on the
115118
`botcity.web.browsers` module.
116119

@@ -120,7 +123,7 @@ the `default options` curated by BotCity and make your changes or start your opt
120123
In the following snippet we will cover how to build on top of the existing options.
121124

122125
```python
123-
from botcity.web import WebBot, Browser
126+
from botcity.web import WebBot, Browser, PageLoadStrategy
124127

125128
# For Chrome
126129
from botcity.web.browsers.chrome import default_options
@@ -138,7 +141,8 @@ class Bot(WebBot):
138141
def_options = default_options(
139142
headless=self.headless,
140143
download_folder_path=self.download_folder_path,
141-
user_data_dir=None # Informing None here will generate a temporary directory
144+
user_data_dir=None, # Informing None here will generate a temporary directory
145+
page_load_strategy=PageLoadStrategy.NORMAL
142146
)
143147

144148
# Add your customized argument

0 commit comments

Comments
 (0)