Skip to content

Commit dd60da9

Browse files
committed
Add: Adding kotlin code sample for CDP [deploy site]
1 parent 1279227 commit dd60da9

8 files changed

+96
-8
lines changed

docs_source_files/content/support_packages/chrome_devtools.de.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public void geoLocationTest(){
4747
// Please raise a PR to add code sample
4848
{{< / code-panel >}}
4949
{{< code-panel language="kotlin" >}}
50-
// Please raise a PR to add code sample
50+
import org.openqa.selenium.chrome.ChromeDriver
51+
import org.openqa.selenium.devtools.DevTools
52+
53+
fun main() {
54+
val driver = ChromeDriver()
55+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
56+
coordinates.put("latitude", 50.2334)
57+
coordinates.put("longitude", 0.2334)
58+
coordinates.put("accuracy", 1)
59+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
60+
driver.get("https://www.google.com")
61+
}
5162
{{< / code-panel >}}
5263
{{< / code-tab >}}
5364

docs_source_files/content/support_packages/chrome_devtools.en.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ public void geoLocationTest(){
4141
// Please raise a PR to add code sample
4242
{{< / code-panel >}}
4343
{{< code-panel language="kotlin" >}}
44-
// Please raise a PR to add code sample
44+
import org.openqa.selenium.chrome.ChromeDriver
45+
import org.openqa.selenium.devtools.DevTools
46+
47+
fun main() {
48+
val driver = ChromeDriver()
49+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
50+
coordinates.put("latitude", 50.2334)
51+
coordinates.put("longitude", 0.2334)
52+
coordinates.put("accuracy", 1)
53+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
54+
driver.get("https://www.google.com")
55+
}
4556
{{< / code-panel >}}
4657
{{< / code-tab >}}
4758

docs_source_files/content/support_packages/chrome_devtools.es.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public void geoLocationTest(){
4747
// Please raise a PR to add code sample
4848
{{< / code-panel >}}
4949
{{< code-panel language="kotlin" >}}
50-
// Please raise a PR to add code sample
50+
import org.openqa.selenium.chrome.ChromeDriver
51+
import org.openqa.selenium.devtools.DevTools
52+
53+
fun main() {
54+
val driver = ChromeDriver()
55+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
56+
coordinates.put("latitude", 50.2334)
57+
coordinates.put("longitude", 0.2334)
58+
coordinates.put("accuracy", 1)
59+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
60+
driver.get("https://www.google.com")
61+
}
5162
{{< / code-panel >}}
5263
{{< / code-tab >}}
5364

docs_source_files/content/support_packages/chrome_devtools.fr.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public void geoLocationTest(){
4747
// Please raise a PR to add code sample
4848
{{< / code-panel >}}
4949
{{< code-panel language="kotlin" >}}
50-
// Please raise a PR to add code sample
50+
import org.openqa.selenium.chrome.ChromeDriver
51+
import org.openqa.selenium.devtools.DevTools
52+
53+
fun main() {
54+
val driver = ChromeDriver()
55+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
56+
coordinates.put("latitude", 50.2334)
57+
coordinates.put("longitude", 0.2334)
58+
coordinates.put("accuracy", 1)
59+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
60+
driver.get("https://www.google.com")
61+
}
5162
{{< / code-panel >}}
5263
{{< / code-tab >}}
5364

docs_source_files/content/support_packages/chrome_devtools.ja.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,18 @@ public void geoLocationTest(){
5151
// Please raise a PR to add code sample
5252
{{< / code-panel >}}
5353
{{< code-panel language="kotlin" >}}
54-
// Please raise a PR to add code sample
54+
import org.openqa.selenium.chrome.ChromeDriver
55+
import org.openqa.selenium.devtools.DevTools
56+
57+
fun main() {
58+
val driver = ChromeDriver()
59+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
60+
coordinates.put("latitude", 50.2334)
61+
coordinates.put("longitude", 0.2334)
62+
coordinates.put("accuracy", 1)
63+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
64+
driver.get("https://www.google.com")
65+
}
5566
{{< / code-panel >}}
5667
{{< / code-tab >}}
5768

docs_source_files/content/support_packages/chrome_devtools.ko.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public void geoLocationTest(){
4747
// Please raise a PR to add code sample
4848
{{< / code-panel >}}
4949
{{< code-panel language="kotlin" >}}
50-
// Please raise a PR to add code sample
50+
import org.openqa.selenium.chrome.ChromeDriver
51+
import org.openqa.selenium.devtools.DevTools
52+
53+
fun main() {
54+
val driver = ChromeDriver()
55+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
56+
coordinates.put("latitude", 50.2334)
57+
coordinates.put("longitude", 0.2334)
58+
coordinates.put("accuracy", 1)
59+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
60+
driver.get("https://www.google.com")
61+
}
5162
{{< / code-panel >}}
5263
{{< / code-tab >}}
5364

docs_source_files/content/support_packages/chrome_devtools.nl.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ public void geoLocationTest(){
4747
// Please raise a PR to add code sample
4848
{{< / code-panel >}}
4949
{{< code-panel language="kotlin" >}}
50-
// Please raise a PR to add code sample
50+
import org.openqa.selenium.chrome.ChromeDriver
51+
import org.openqa.selenium.devtools.DevTools
52+
53+
fun main() {
54+
val driver = ChromeDriver()
55+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
56+
coordinates.put("latitude", 50.2334)
57+
coordinates.put("longitude", 0.2334)
58+
coordinates.put("accuracy", 1)
59+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
60+
driver.get("https://www.google.com")
61+
}
5162
{{< / code-panel >}}
5263
{{< / code-tab >}}
5364

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ public void geoLocationTest(){
4141
// Please raise a PR to add code sample
4242
{{< / code-panel >}}
4343
{{< code-panel language="kotlin" >}}
44-
// Please raise a PR to add code sample
44+
import org.openqa.selenium.chrome.ChromeDriver
45+
import org.openqa.selenium.devtools.DevTools
46+
47+
fun main() {
48+
val driver = ChromeDriver()
49+
val coordinates : HashMap<String, Any> = HashMap<String, Any> ()
50+
coordinates.put("latitude", 50.2334)
51+
coordinates.put("longitude", 0.2334)
52+
coordinates.put("accuracy", 1)
53+
driver.executeCdpCommand("Emulation.setGeolocationOverride", coordinates)
54+
driver.get("https://www.google.com")
55+
}
4556
{{< / code-panel >}}
4657
{{< / code-tab >}}
4758

0 commit comments

Comments
 (0)