Skip to content

Commit d5b4294

Browse files
dbudimharsha509
andauthored
[chrome_devtools] add Basic Auth example in Java (SeleniumHQ#658)[deploy site]
* [chrome_devtools] add Basic Auth example in Java * [chrome_devtools] add driver type that supports basic auth * [chrome_devtools] add HasAuthentication Co-authored-by: Sri Harsha <[email protected]>
1 parent 9b21726 commit d5b4294

9 files changed

+36
-9
lines changed

docs_source_files/content/support_packages/chrome_devtools.de.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
123123

124124
{{< code-tab >}}
125125
{{< code-panel language="java" >}}
126-
# Please raise a PR to add code sample
126+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
127+
128+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
129+
driver.get("https://your-domain.com/login");
127130
{{< / code-panel >}}
128131
{{< code-panel language="python" >}}
129132
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.en.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
116116

117117
{{< code-tab >}}
118118
{{< code-panel language="java" >}}
119-
# Please raise a PR to add code sample
119+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
120+
121+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
122+
driver.get("https://your-domain.com/login");
120123
{{< / code-panel >}}
121124
{{< code-panel language="python" >}}
122125
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.es.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
122122

123123
{{< code-tab >}}
124124
{{< code-panel language="java" >}}
125-
# Please raise a PR to add code sample
125+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
126+
127+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
128+
driver.get("https://your-domain.com/login");
126129
{{< / code-panel >}}
127130
{{< code-panel language="python" >}}
128131
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.fr.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
122122

123123
{{< code-tab >}}
124124
{{< code-panel language="java" >}}
125-
# Please raise a PR to add code sample
125+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
126+
127+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
128+
driver.get("https://your-domain.com/login");
126129
{{< / code-panel >}}
127130
{{< code-panel language="python" >}}
128131
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.ja.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
126126

127127
{{< code-tab >}}
128128
{{< code-panel language="java" >}}
129-
# Please raise a PR to add code sample
129+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
130+
131+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
132+
driver.get("https://your-domain.com/login");
130133
{{< / code-panel >}}
131134
{{< code-panel language="python" >}}
132135
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.ko.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
122122

123123
{{< code-tab >}}
124124
{{< code-panel language="java" >}}
125-
# Please raise a PR to add code sample
125+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
126+
127+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
128+
driver.get("https://your-domain.com/login");
126129
{{< / code-panel >}}
127130
{{< code-panel language="python" >}}
128131
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.nl.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
122122

123123
{{< code-tab >}}
124124
{{< code-panel language="java" >}}
125-
# Please raise a PR to add code sample
125+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
126+
127+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
128+
driver.get("https://your-domain.com/login");
126129
{{< / code-panel >}}
127130
{{< code-panel language="python" >}}
128131
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.pt-br.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ With Selenium and devtools integration, you can automate the input of basic auth
116116

117117
{{< code-tab >}}
118118
{{< code-panel language="java" >}}
119-
# Please raise a PR to add code sample
119+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
120+
121+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
122+
driver.get("https://your-domain.com/login");
120123
{{< / code-panel >}}
121124
{{< code-panel language="python" >}}
122125
# Please raise a PR to add code sample

docs_source_files/content/support_packages/chrome_devtools.zh-cn.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ fun main() {
119119

120120
{{< code-tab >}}
121121
{{< code-panel language="java" >}}
122-
# Please raise a PR to add code sample
122+
Predicate<URI> uriPredicate = uri -> uri.getHost().contains("your-domain.com");
123+
124+
((HasAuthentication) driver).register(uriPredicate, UsernameAndPassword.of("admin", "password"));
125+
driver.get("https://your-domain.com/login");
123126
{{< / code-panel >}}
124127
{{< code-panel language="python" >}}
125128
# Please raise a PR to add code sample

0 commit comments

Comments
 (0)