Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1145be8

Browse files
rename page and add section on Usage
1 parent 7be8bee commit 1145be8

File tree

10 files changed

+203
-88
lines changed

10 files changed

+203
-88
lines changed

‎examples/dotnet/SeleniumDocs/GettingStarted/RunningTestsTest.cs‎ renamed to ‎examples/dotnet/SeleniumDocs/GettingStarted/UsingSeleniumTest.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
namespace SeleniumDocs.GettingStarted
77
{
88
[TestClass]
9-
public class RunningTestsTest
9+
public class UsingSeleniumTest
1010
{
1111

1212
[TestMethod]
13-
public void ChromeSession()
13+
public void EightComponents()
1414
{
1515
IWebDriver driver = new ChromeDriver();
1616

‎examples/java/src/test/java/dev/selenium/browsers/ChromeTest.java‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
import org.junit.jupiter.api.Assertions;
66
import org.junit.jupiter.api.Test;
77
import org.openqa.selenium.By;
8+
import org.openqa.selenium.Pdf;
89
import org.openqa.selenium.WebElement;
910
import org.openqa.selenium.chrome.ChromeDriver;
1011
import org.openqa.selenium.chrome.ChromeDriverService;
1112
import org.openqa.selenium.chrome.ChromeOptions;
1213
import org.openqa.selenium.chromium.ChromiumDriverLogLevel;
14+
import org.openqa.selenium.print.PrintOptions;
1315

14-
import java.io.File;
15-
import java.io.IOException;
16-
import java.io.PrintStream;
16+
import java.io.*;
1717
import java.nio.file.Files;
1818
import java.nio.file.Path;
1919
import java.nio.file.Paths;
20+
import java.util.Base64;
2021
import java.util.regex.Pattern;
2122

2223
public class ChromeTest {
@@ -35,9 +36,14 @@ public void quit() {
3536
}
3637

3738
@Test
38-
public void basicOptions() {
39+
public void basicOptions() throwsIOException{
3940
ChromeOptions options = new ChromeOptions();
4041
driver = new ChromeDriver(options);
42+
driver.get("https://www.selenium.dev");
43+
44+
String content = driver.print(new PrintOptions()).getContent();
45+
byte[] bytes = Base64.getDecoder().decode(content);
46+
Files.write(Paths.get("printed.pdf"), bytes);
4147
}
4248

4349
@Test

‎examples/java/src/test/java/dev/selenium/getting_started/RunningTestsTest.java‎ renamed to ‎examples/java/src/test/java/dev/selenium/getting_started/UsingSeleniumTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import static org.junit.jupiter.api.Assertions.assertEquals;
1212

13-
public class RunningTestsTest {
13+
public class UsingSelenium {
1414

1515
@Test
1616
public void eightComponents() {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package dev.selenium.interactions;
2+
3+
import dev.selenium.BaseChromeTest;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
6+
import org.openqa.selenium.By;
7+
import org.openqa.selenium.NoSuchElementException;
8+
import org.openqa.selenium.print.PrintOptions;
9+
import org.openqa.selenium.remote.RemoteWebDriver;
10+
11+
import java.io.IOException;
12+
import java.nio.file.Files;
13+
import java.nio.file.Paths;
14+
import java.util.Base64;
15+
16+
public class SavingTest extends BaseChromeTest {
17+
@Test
18+
public void prints() throws IOException {
19+
driver.get("https://www.selenium.dev");
20+
21+
String content = ((RemoteWebDriver) driver).print(new PrintOptions()).getContent();
22+
byte[] bytes = Base64.getDecoder().decode(content);
23+
Files.write(Paths.get("selenium.pdf"), bytes);
24+
}
25+
}

‎examples/ruby/spec/getting_started/running_tests_spec.rb‎ renamed to ‎examples/ruby/spec/getting_started/using_selenium_spec.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper'
44

5-
RSpec.describe 'Running Tests' do
5+
RSpec.describe 'Using Selenium' do
66
it 'uses eight components' do
77
driver = Selenium::WebDriver.for :chrome
88

‎website_and_docs/content/documentation/webdriver/getting_started/running_tests.en.md‎ renamed to ‎website_and_docs/content/documentation/webdriver/getting_started/using_selenium.en.md‎

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,52 @@
11
---
2-
title: "Organizing and Executing Selenium in Tests"
3-
linkTitle: "Running Tests"
2+
title: "Organizing and Executing Selenium Code"
3+
linkTitle: "Using Selenium"
44
weight: 10
55
description: >
6-
Scaling Selenium execution with a Test Runner Framework
6+
Scaling Selenium execution with an IDE and a Test Runner library
77
---
88

9+
{{< alert-content >}}
10+
This page is very incomplete and has placeholders for things that need to be added or expounded on.
11+
{{< /alert-content >}}
12+
913
If you want to run more than a handful of one-off scripts, you need to
10-
be able to organize and work with your code.
11-
Most people use Selenium for testing, so that is the context that often
12-
gets used to talk about executing Selenium code, so it is worth giving
13-
an overview of how to use Selenium in this context.
14-
Running Selenium in tests requires making assertions and using common setup and teardown code.
15-
It often involves running multiple sessions in parallel,
16-
and sometimes running specific subsets of sessions.
14+
be able to organize and work with your code. This page should give you
15+
ideas for how to actually do productive things with your Selenium code.
16+
17+
## Common Uses
18+
19+
Most people use Selenium to execute automated tests for web applications,
20+
but Selenium support any use case of browser automation.
21+
22+
### Repetitive Tasks
23+
24+
### Testing
25+
26+
Running Selenium for testing requires making assertions on actions taken by Selenium.
27+
So a good assertion library is required. Additional features to provide structure for tests
28+
require use of [Test Runner](#test-runners)
1729

1830

1931
## IDEs
2032

21-
First and foremost, you won't be very effective in building out a test suite without a good
33+
Regardless of how you use Selenium code,
34+
you won't be very effective writing or executing it without a good
2235
Integrated Developer Environment. Here are some common options...
2336

37+
* Eclipse
38+
* IntelliJ
39+
* PyCharm
40+
* RubyMine
41+
* Rider
42+
* WebStorm
43+
* VS Code
2444

25-
## Test Runners
45+
## Test Runner
46+
47+
Even if you aren't using Selenium for testing, if you have advanced use cases, it might make
48+
sense to use a test runner to better organize your code. Being able to use before/after hooks
49+
and run things in groups or in parallel can be very useful.
2650

2751
### Choosing
2852
There are many different test runners available.
@@ -145,7 +169,7 @@ Use the Java bindings for Kotlin.
145169
### Executing
146170

147171
{{< tabpane text=true langEqualsHeader=true >}}
148-
{{< tab header="Java" >}}
172+
{{% tab header="Java" %}}
149173
### Maven
150174

151175
```shell
@@ -158,7 +182,7 @@ mvn clean test
158182
gradle clean test
159183
```
160184

161-
{{< /tab >}}
185+
{{% /tab %}}
162186
{{% tab header="Python" %}}
163187
{{< badge-code >}}
164188
{{% /tab %}}
@@ -168,11 +192,11 @@ gradle clean test
168192
{{< tab header="Ruby" >}}
169193
{{< badge-code >}}
170194
{{< /tab >}}
171-
{{< tab header="JavaScript" >}}
195+
{{% tab header="JavaScript" %}}
172196
```shell
173197
mocha runningTests.spec.js
174198
```
175-
{{< /tab >}}
199+
{{% /tab %}}
176200
{{< tab header="Kotlin" >}}
177201
{{< badge-code >}}
178202
{{< /tab >}}
@@ -185,16 +209,16 @@ Here's an example of that code using a test runner:
185209

186210
{{< tabpane text=true langEqualsHeader=true >}}
187211
{{< tab header="Java" >}}
188-
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/RunningTestsTest.java" >}}
212+
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/UsingSeleniumTest.java" >}}
189213
{{< /tab >}}
190214
{{< tab header="Python" >}}
191-
{{< gh-codeblock path="examples/python/tests/getting_started/test_running_tests.py" >}}
215+
{{< gh-codeblock path="examples/python/tests/getting_started/using_selenium_tests.py" >}}
192216
{{< /tab >}}
193217
{{< tab header="CSharp" >}}
194-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/RunningTestsTest.cs" >}}
218+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/UsingSeleniumTest.cs" >}}
195219
{{< /tab >}}
196220
{{< tab header="Ruby" >}}
197-
{{< gh-codeblock path="examples/ruby/spec/getting_started/running_tests_spec.rb" >}}
221+
{{< gh-codeblock path="examples/ruby/spec/getting_started/using_selenium_spec.rb" >}}
198222
{{< /tab >}}
199223
{{< tab header="JavaScript" >}}
200224
{{< badge-code >}}

‎website_and_docs/content/documentation/webdriver/getting_started/running_tests.ja.md‎ renamed to ‎website_and_docs/content/documentation/webdriver/getting_started/using_selenium.ja.md‎

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
11
---
2-
title: "Organizing and Executing Selenium in Tests"
3-
linkTitle: "Running Tests"
2+
title: "Organizing and Executing Selenium Code"
3+
linkTitle: "Using Selenium"
44
weight: 10
55
description: >
6-
Scaling Selenium execution with a Test Runner Framework
6+
Scaling Selenium execution with an IDE and a Test Runner library
77
---
88

99
If you want to run more than a handful of one-off scripts, you need to
10-
be able to organize and work with your code.
11-
Most people use Selenium for testing, so that is the context that often
12-
gets used to talk about executing Selenium code, so it is worth giving
13-
an overview of how to use Selenium in this context.
14-
Running Selenium in tests requires making assertions and using common setup and teardown code.
15-
It often involves running multiple sessions in parallel,
16-
and sometimes running specific subsets of sessions.
10+
be able to organize and work with your code. This page should give you
11+
ideas for how to actually do productive things with your Selenium code.
12+
13+
## Common Uses
14+
15+
Most people use Selenium to execute automated tests for web applications,
16+
but Selenium support any use case of browser automation.
17+
18+
### Repetitive Tasks
19+
20+
### Testing
21+
22+
Running Selenium for testing requires making assertions on actions taken by Selenium.
23+
So a good assertion library is required. Additional features to provide structure for tests
24+
require use of [Test Runner](#test-runners)
1725

1826

1927
## IDEs
2028

21-
First and foremost, you won't be very effective in building out a test suite without a good
29+
Regardless of how you use Selenium code,
30+
you won't be very effective writing or executing it without a good
2231
Integrated Developer Environment. Here are some common options...
2332

33+
* Eclipse
34+
* IntelliJ
35+
* PyCharm
36+
* RubyMine
37+
* Rider
38+
* WebStorm
39+
* VS Code
40+
41+
## Test Runner
2442

25-
## Test Runners
43+
Even if you aren't using Selenium for testing, if you have advanced use cases, it might make
44+
sense to use a test runner to better organize your code. Being able to use before/after hooks
45+
and run things in groups or in parallel can be very useful.
2646

2747
### Choosing
2848
There are many different test runners available.
@@ -145,7 +165,7 @@ Use the Java bindings for Kotlin.
145165
### Executing
146166

147167
{{< tabpane text=true langEqualsHeader=true >}}
148-
{{< tab header="Java" >}}
168+
{{% tab header="Java" %}}
149169
### Maven
150170

151171
```shell
@@ -158,7 +178,7 @@ mvn clean test
158178
gradle clean test
159179
```
160180

161-
{{< /tab >}}
181+
{{% /tab %}}
162182
{{% tab header="Python" %}}
163183
{{< badge-code >}}
164184
{{% /tab %}}
@@ -168,11 +188,11 @@ gradle clean test
168188
{{< tab header="Ruby" >}}
169189
{{< badge-code >}}
170190
{{< /tab >}}
171-
{{< tab header="JavaScript" >}}
191+
{{% tab header="JavaScript" %}}
172192
```shell
173193
mocha runningTests.spec.js
174194
```
175-
{{< /tab >}}
195+
{{% /tab %}}
176196
{{< tab header="Kotlin" >}}
177197
{{< badge-code >}}
178198
{{< /tab >}}
@@ -185,16 +205,16 @@ Here's an example of that code using a test runner:
185205

186206
{{< tabpane text=true langEqualsHeader=true >}}
187207
{{< tab header="Java" >}}
188-
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/RunningTestsTest.java" >}}
208+
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/UsingSeleniumTest.java" >}}
189209
{{< /tab >}}
190210
{{< tab header="Python" >}}
191-
{{< gh-codeblock path="examples/python/tests/getting_started/test_running_tests.py" >}}
211+
{{< gh-codeblock path="examples/python/tests/getting_started/using_selenium_tests.py" >}}
192212
{{< /tab >}}
193213
{{< tab header="CSharp" >}}
194-
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/RunningTestsTest.cs" >}}
214+
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/GettingStarted/UsingSeleniumTest.cs" >}}
195215
{{< /tab >}}
196216
{{< tab header="Ruby" >}}
197-
{{< gh-codeblock path="examples/ruby/spec/getting_started/running_tests_spec.rb" >}}
217+
{{< gh-codeblock path="examples/ruby/spec/getting_started/using_selenium_spec.rb" >}}
198218
{{< /tab >}}
199219
{{< tab header="JavaScript" >}}
200220
{{< badge-code >}}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /