Skip to content

Commit cfda4d0

Browse files
titusfortnerdiemol
andauthored
reorganize capabilities documentation (SeleniumHQ#846) [deploy site]
Co-authored-by: Diego Molina <[email protected]>
1 parent 39824e5 commit cfda4d0

36 files changed

+1423
-2348
lines changed

website_and_docs/content/documentation/webdriver/capabilities/_index.en.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
title: "WebDriver Capabilities"
33
linkTitle: "Capabilities"
44
weight: 4
5-
aliases: ["/documentation/en/driver_idiosyncrasies/"]
5+
aliases: [
6+
"/documentation/en/driver_idiosyncrasies/",
7+
"/documentation/en/driver_idiosyncrasies/driver_specific_capabilities/",
8+
"/documentation/webdriver/capabilities/driver_specific_capabilities/"
9+
]
610
---

website_and_docs/content/documentation/webdriver/capabilities/_index.ja.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
title: "Capabilities"
33
linkTitle: "Capabilities"
44
weight: 4
5-
aliases: ["/documentation/ja/driver_idiosyncrasies/"]
5+
aliases: [
6+
"/documentation/ja/driver_idiosyncrasies/",
7+
"/documentation/ja/driver_idiosyncrasies/driver_specific_capabilities/",
8+
"/ja/documentation/webdriver/capabilities/driver_specific_capabilities/"
9+
]
610
---
711

812
{{% pageinfo color="warning" %}}

website_and_docs/content/documentation/webdriver/capabilities/_index.pt-br.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
title: "Capabilities"
33
linkTitle: "Capabilities"
44
weight: 4
5-
aliases: ["/documentation/pt-br/driver_idiosyncrasies/"]
5+
aliases: [
6+
"/documentation/pt-br/driver_idiosyncrasies/",
7+
"/documentation/pt-br/driver_idiosyncrasies/driver_specific_capabilities/",
8+
"/pt-br/documentation/webdriver/capabilities/driver_specific_capabilities/"
9+
]
610
---
711

812
{{% pageinfo color="warning" %}}

website_and_docs/content/documentation/webdriver/capabilities/_index.zh-cn.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
title: "Capabilities"
33
linkTitle: "Capabilities"
44
weight: 4
5-
aliases: ["/documentation/zh-cn/driver_idiosyncrasies/"]
5+
aliases: [
6+
"/documentation/zh-cn/driver_idiosyncrasies/",
7+
"/documentation/zh-cn/driver_idiosyncrasies/driver_specific_capabilities/",
8+
"/zh-cn/documentation/webdriver/capabilities/driver_specific_capabilities/"
9+
]
610
---
711

812
{{% pageinfo color="warning" %}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Capabilities specific to Chromium browsers"
3+
linkTitle: "Chromium"
4+
weight: 4
5+
description: >-
6+
These capabilities are specific to Chromium based browsers.
7+
---
8+
9+
These Capabilities apply to:
10+
* Chrome
11+
* Chromium
12+
* Edge
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Capabilities specific to Chromium browsers"
3+
linkTitle: "Chromium"
4+
weight: 4
5+
needsTranslation: true
6+
description: >-
7+
These capabilities are specific to Chromium based browsers.
8+
---
9+
10+
These Capabilities apply to:
11+
* Chrome
12+
* Chromium
13+
* Edge
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Capabilities specific to Chromium browsers"
3+
linkTitle: "Chromium"
4+
weight: 4
5+
needsTranslation: true
6+
description: >-
7+
These capabilities are specific to Chromium based browsers.
8+
---
9+
10+
These Capabilities apply to:
11+
* Chrome
12+
* Chromium
13+
* Edge
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Capabilities specific to Chromium browsers"
3+
linkTitle: "Chromium"
4+
weight: 4
5+
needsTranslation: true
6+
description: >-
7+
These capabilities are specific to Chromium based browsers.
8+
---
9+
10+
These Capabilities apply to:
11+
* Chrome
12+
* Chromium
13+
* Edge
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: "Capabilities specific to Firefox browser"
3+
linkTitle: "Firefox"
4+
weight: 6
5+
description: >-
6+
These capabilities are specific to Firefox.
7+
---
8+
9+
### Define Capabilities using `FirefoxOptions`
10+
11+
`FirefoxOptions` is the new way to define capabilities for the Firefox
12+
browser and should generally be used in preference to DesiredCapabilities.
13+
14+
<div>
15+
{{< tabpane langEqualsHeader=true >}}
16+
{{< tab header="Java" >}}
17+
FirefoxOptions options = new FirefoxOptions();
18+
options.addPreference("network.proxy.type", 0);
19+
driver = new RemoteWebDriver(options);
20+
{{< /tab >}}
21+
{{< tab header="Python" >}}
22+
from selenium.webdriver.firefox.options import Options
23+
options = Options()
24+
options.headless = True
25+
driver = webdriver.Firefox(options=options)
26+
{{< /tab >}}
27+
{{< tab header="CSharp" >}}
28+
var options = new FirefoxOptions();
29+
options.Proxy.Kind = ProxyKind.Direct;
30+
var driver = new FirefoxDriver(options);
31+
{{< /tab >}}
32+
{{< tab header="Ruby" >}}
33+
require 'selenium-webdriver'
34+
opts = Selenium::WebDriver::Firefox::Options.new(args: ['-headless'])
35+
driver = Selenium::WebDriver.for(:firefox, options: opts)
36+
{{< /tab >}}
37+
{{< tab header="JavaScript" >}}
38+
const { Builder } = require("selenium-webdriver");
39+
const firefox = require('selenium-webdriver/firefox');
40+
41+
const options = new firefox.Options();
42+
options.headless();
43+
const driver = new Builder()
44+
.forBrowser('firefox')
45+
.setFirefoxOptions(options)
46+
.build();
47+
{{< /tab >}}
48+
{{< tab header="Kotlin" >}}
49+
val options = new FirefoxOptions()
50+
options.addPreference("network.proxy.type", 0)
51+
driver = RemoteWebDriver(options)
52+
{{< /tab >}}
53+
{{< /tabpane >}}
54+
</div>
55+
56+
### Setting a custom profile
57+
58+
It is possible to create a custom profile for Firefox as demonstrated below.
59+
60+
<div>
61+
{{< tabpane langEqualsHeader=true >}}
62+
{{< tab header="Java" >}}
63+
FirefoxProfile profile = new FirefoxProfile();
64+
FirefoxOptions options = new FirefoxOptions();
65+
options.setProfile(profile);
66+
driver = new RemoteWebDriver(options);
67+
{{< /tab >}}
68+
{{< tab header="Python" >}}
69+
from selenium.webdriver.firefox.options import Options
70+
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
71+
options=Options()
72+
firefox_profile = FirefoxProfile()
73+
firefox_profile.set_preference("javascript.enabled", False)
74+
options.profile = firefox_profile
75+
{{< /tab >}}
76+
{{< tab header="CSharp" >}}
77+
var options = new FirefoxOptions();
78+
var profile = new FirefoxProfile();
79+
options.Profile = profile;
80+
var driver = new RemoteWebDriver(options);
81+
{{< /tab >}}
82+
{{< tab header="Ruby" >}}
83+
profile = Selenium::WebDriver::Firefox::Profile.new
84+
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
85+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
86+
driver = Selenium::WebDriver.for :firefox, options: options
87+
{{< /tab >}}
88+
{{< tab header="JavaScript" >}}
89+
const { Builder } = require("selenium-webdriver");
90+
const firefox = require('selenium-webdriver/firefox');
91+
92+
const options = new firefox.Options();
93+
let profile = '/path to custom profile';
94+
options.setProfile(profile);
95+
const driver = new Builder()
96+
.forBrowser('firefox')
97+
.setFirefoxOptions(options)
98+
.build();
99+
{{< /tab >}}
100+
{{< tab header="Kotlin" >}}
101+
val options = FirefoxOptions()
102+
options.profile = FirefoxProfile()
103+
driver = RemoteWebDriver(options)
104+
{{< /tab >}}
105+
{{< /tabpane >}}
106+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "Capabilities specific to Firefox browser"
3+
linkTitle: "Firefox"
4+
weight: 6
5+
needsTranslation: true
6+
description: >-
7+
These capabilities are specific to Firefox.
8+
---
9+
10+
### `FirefoxOptions` を使用してCapabilitiesを定義する
11+
12+
`FirefoxOptions` は、Firefoxブラウザの機能を定義する新しい方法であり、通常はDesiredCapabilitiesよりも優先して使用する必要があります。
13+
14+
{{< tabpane langEqualsHeader=true >}}
15+
{{< tab header="Java" >}}
16+
FirefoxOptions options = new FirefoxOptions();
17+
options.addPreference("network.proxy.type", 0);
18+
driver = new RemoteWebDriver(options);
19+
{{< /tab >}}
20+
{{< tab header="Python" >}}
21+
from selenium.webdriver.firefox.options import Options
22+
options = Options()
23+
options.headless = True
24+
driver = webdriver.Firefox(options=options)
25+
{{< /tab >}}
26+
{{< tab header="CSharp" >}}
27+
var options = new FirefoxOptions();
28+
options.Proxy.Kind = ProxyKind.Direct;
29+
var driver = new FirefoxDriver(options);
30+
{{< /tab >}}
31+
{{< tab header="Ruby" >}}
32+
require 'selenium-webdriver'
33+
opts = Selenium::WebDriver::Firefox::Options.new(args: ['-headless'])
34+
driver = Selenium::WebDriver.for(:firefox, options: opts)
35+
{{< /tab >}}
36+
{{< tab header="JavaScript" >}}
37+
const { Builder } = require("selenium-webdriver");
38+
const firefox = require('selenium-webdriver/firefox');
39+
40+
const options = new firefox.Options();
41+
options.headless();
42+
const driver = new Builder()
43+
.forBrowser('firefox')
44+
.setFirefoxOptions(options)
45+
.build();
46+
{{< /tab >}}
47+
{{< tab header="Kotlin" >}}
48+
val options = new FirefoxOptions()
49+
options.addPreference("network.proxy.type", 0)
50+
driver = RemoteWebDriver(options)
51+
{{< /tab >}}
52+
{{< /tabpane >}}
53+
54+
55+
### カスタムプロファイルを設定する
56+
57+
以下に示すように、Firefoxのカスタムプロファイルを作成することができます。
58+
59+
{{< tabpane langEqualsHeader=true >}}
60+
{{< tab header="Java" >}}
61+
FirefoxProfile profile = new FirefoxProfile();
62+
FirefoxOptions options = new FirefoxOptions();
63+
options.setProfile(profile);
64+
driver = new RemoteWebDriver(options);
65+
{{< /tab >}}
66+
{{< tab header="Python" >}}
67+
from selenium.webdriver.firefox.options import Options
68+
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
69+
options=Options()
70+
firefox_profile = FirefoxProfile()
71+
firefox_profile.set_preference("javascript.enabled", False)
72+
options.profile = firefox_profile
73+
{{< /tab >}}
74+
{{< tab header="CSharp" >}}
75+
var options = new FirefoxOptions();
76+
var profile = new FirefoxProfile();
77+
options.Profile = profile;
78+
var driver = new RemoteWebDriver(options);
79+
{{< /tab >}}
80+
{{< tab header="Ruby" >}}
81+
profile = Selenium::WebDriver::Firefox::Profile.new
82+
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
83+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
84+
driver = Selenium::WebDriver.for :firefox, options: options
85+
{{< /tab >}}
86+
{{< tab header="JavaScript" >}}
87+
const { Builder } = require("selenium-webdriver");
88+
const firefox = require('selenium-webdriver/firefox');
89+
90+
const options = new firefox.Options();
91+
let profile = '/path to custom profile';
92+
options.setProfile(profile);
93+
const driver = new Builder()
94+
.forBrowser('firefox')
95+
.setFirefoxOptions(options)
96+
.build();
97+
{{< /tab >}}
98+
{{< tab header="Kotlin" >}}
99+
val options = FirefoxOptions()
100+
options.profile = FirefoxProfile()
101+
driver = RemoteWebDriver(options)
102+
{{< /tab >}}
103+
{{< /tabpane >}}

0 commit comments

Comments
 (0)