Skip to content

Commit bc67d34

Browse files
authored
Added Selenium Manager Code Examples (#1870)
* added setup and teardown python examples to Organizing and Executing Selenium Code * added examples for selenium manager to documentation [deploy site]
1 parent 85d7b19 commit bc67d34

File tree

5 files changed

+104
-0
lines changed

5 files changed

+104
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from selenium import webdriver
2+
from selenium.webdriver.common.by import By
3+
from selenium.webdriver.chrome.service import Service
4+
5+
def setup_without_selenium_manager():
6+
chrome_service = Service(executable_path='path/to/chrome.exe')
7+
driver = webdriver.Chrome(chrome_service)
8+
return driver
9+
10+
def setup_with_selenium_manager():
11+
driver = webdriver.Chrome()
12+
return driver

website_and_docs/content/documentation/selenium_manager.en.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ INFO Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\117.0.5938
209209
INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\chrome.exe
210210
```
211211

212+
### Implementing Selenium Manager in Your Scripts
213+
214+
{{< tabpane text=true >}}
215+
{{< tab header="Java" >}}
216+
{{< /tab >}}
217+
{{% tab header="Python" %}}
218+
**Previously**
219+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L5-L8" >}}
220+
**Selenium Manager**
221+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L10-L12" >}}
222+
{{< badge-code >}}
223+
{{< /tab >}}
224+
{{< tab header="CSharp" >}}
225+
{{< /tab >}}
226+
{{< tab header="Ruby" >}}
227+
{{< /tab >}}
228+
{{< tab header="JavaScript" >}}
229+
{{< /tab >}}
230+
{{< tab header="Kotlin" >}}
231+
{{< badge-code >}}
232+
{{< /tab >}}
233+
{{< /tabpane >}}
234+
212235
## Selenium Grid
213236
Selenium Manager allows you to configure the drivers automatically when setting up Selenium Grid. To that aim, you need to include the argument `--selenium-manager true` in the command to start Selenium Grid. For more details, visit the [Selenium Grid starting page](https://www.selenium.dev/documentation/grid/getting_started/).
214237

website_and_docs/content/documentation/selenium_manager.ja.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ INFO Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\117.0.5938
209209
INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\chrome.exe
210210
```
211211

212+
### Implementing Selenium Manager in Your Scripts
213+
214+
{{< tabpane text=true >}}
215+
{{< tab header="Java" >}}
216+
{{< /tab >}}
217+
{{% tab header="Python" %}}
218+
**Previously**
219+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L5-L8" >}}
220+
**Selenium Manager**
221+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L10-L12" >}}
222+
{{< badge-code >}}
223+
{{< /tab >}}
224+
{{< tab header="CSharp" >}}
225+
{{< /tab >}}
226+
{{< tab header="Ruby" >}}
227+
{{< /tab >}}
228+
{{< tab header="JavaScript" >}}
229+
{{< /tab >}}
230+
{{< tab header="Kotlin" >}}
231+
{{< badge-code >}}
232+
{{< /tab >}}
233+
{{< /tabpane >}}
234+
212235
## Selenium Grid
213236
Selenium Manager allows you to configure the drivers automatically when setting up Selenium Grid. To that aim, you need to include the argument `--selenium-manager true` in the command to start Selenium Grid. For more details, visit the [Selenium Grid starting page](https://www.selenium.dev/documentation/grid/getting_started/).
214237

website_and_docs/content/documentation/selenium_manager.pt-br.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ INFO Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\117.0.5938
209209
INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\chrome.exe
210210
```
211211

212+
### Implementing Selenium Manager in Your Scripts
213+
214+
{{< tabpane text=true >}}
215+
{{< tab header="Java" >}}
216+
{{< /tab >}}
217+
{{% tab header="Python" %}}
218+
**Previously**
219+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L5-L8" >}}
220+
**Selenium Manager**
221+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L10-L12" >}}
222+
{{< badge-code >}}
223+
{{< /tab >}}
224+
{{< tab header="CSharp" >}}
225+
{{< /tab >}}
226+
{{< tab header="Ruby" >}}
227+
{{< /tab >}}
228+
{{< tab header="JavaScript" >}}
229+
{{< /tab >}}
230+
{{< tab header="Kotlin" >}}
231+
{{< badge-code >}}
232+
{{< /tab >}}
233+
{{< /tabpane >}}
234+
212235
## Selenium Grid
213236
Selenium Manager allows you to configure the drivers automatically when setting up Selenium Grid. To that aim, you need to include the argument `--selenium-manager true` in the command to start Selenium Grid. For more details, visit the [Selenium Grid starting page](https://www.selenium.dev/documentation/grid/getting_started/).
214237

website_and_docs/content/documentation/selenium_manager.zh-cn.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,29 @@ INFO Driver path: C:\Users\boni\.cache\selenium\chromedriver\win64\117.0.5938
209209
INFO Browser path: C:\Users\boni\.cache\selenium\chrome\win64\117.0.5938.22\chrome.exe
210210
```
211211

212+
### Implementing Selenium Manager in Your Scripts
213+
214+
{{< tabpane text=true >}}
215+
{{< tab header="Java" >}}
216+
{{< /tab >}}
217+
{{% tab header="Python" %}}
218+
**Previously**
219+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L5-L8" >}}
220+
**Selenium Manager**
221+
{{< gh-codeblock path="examples/python/tests/selenium_manager/usage.py#L10-L12" >}}
222+
{{< badge-code >}}
223+
{{< /tab >}}
224+
{{< tab header="CSharp" >}}
225+
{{< /tab >}}
226+
{{< tab header="Ruby" >}}
227+
{{< /tab >}}
228+
{{< tab header="JavaScript" >}}
229+
{{< /tab >}}
230+
{{< tab header="Kotlin" >}}
231+
{{< badge-code >}}
232+
{{< /tab >}}
233+
{{< /tabpane >}}
234+
212235
## Selenium Grid
213236
Selenium Manager allows you to configure the drivers automatically when setting up Selenium Grid. To that aim, you need to include the argument `--selenium-manager true` in the command to start Selenium Grid. For more details, visit the [Selenium Grid starting page](https://www.selenium.dev/documentation/grid/getting_started/).
214237

0 commit comments

Comments
 (0)