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 e4d80d3

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

File tree

14 files changed

+239
-100
lines changed

14 files changed

+239
-100
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/first_script.en.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,15 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}).
226226
{{< /tab >}}
227227
{{< /tabpane >}}
228228

229+
## Running Selenium File
230+
231+
{{< alert-code >}}
232+
Add example for how to execute each of the above pages via command line
233+
{{< /alert-code >}}
234+
235+
229236
## Next Steps
230237

231238
Most Selenium users execute many sessions and need to organize them to minimize duplication and keep the code
232-
more maintainable.
233-
To see these 8 components in a single script as part of a test runner,
234-
read on to learn about [Organizing and Executing Selenium in Tests]({{< ref "running_tests.md" >}}).
239+
more maintainable. Read on to learn about how to put this code into context for your use case with
240+
[Using Selenium]({{< ref "using_selenium.md" >}}).

‎website_and_docs/content/documentation/webdriver/getting_started/first_script.ja.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,15 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}).
229229
{{< /tabpane >}}
230230

231231

232+
## Running Selenium File
233+
234+
{{< alert-code >}}
235+
Add example for how to execute each of the above pages via command line
236+
{{< /alert-code >}}
237+
238+
232239
## Next Steps
233240

234241
Most Selenium users execute many sessions and need to organize them to minimize duplication and keep the code
235-
more maintainable.
236-
To see these 8 components in a single script as part of a test runner,
237-
read on to learn about [Organizing and Executing Selenium in Tests]({{< ref "running_tests.md" >}}).
242+
more maintainable. Read on to learn about how to put this code into context for your use case with
243+
[Using Selenium]({{< ref "using_selenium.md" >}}).

‎website_and_docs/content/documentation/webdriver/getting_started/first_script.pt-br.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,15 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}).
228228
{{< /tabpane >}}
229229

230230

231+
## Running Selenium File
232+
233+
{{< alert-code >}}
234+
Add example for how to execute each of the above pages via command line
235+
{{< /alert-code >}}
236+
237+
231238
## Próximos Passos
232239

233240
Most Selenium users execute many sessions and need to organize them to minimize duplication and keep the code
234-
more maintainable.
235-
To see these 8 components in a single script as part of a test runner,
236-
read on to learn about [Organizing and Executing Selenium in Tests]({{< ref "running_tests.md" >}}).
241+
more maintainable. Read on to learn about how to put this code into context for your use case with
242+
[Using Selenium]({{< ref "using_selenium.md" >}}).

‎website_and_docs/content/documentation/webdriver/getting_started/first_script.zh-cn.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,15 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}).
241241
{{< /tabpane >}}
242242

243243

244+
## Running Selenium File
245+
246+
{{< alert-code >}}
247+
Add example for how to execute each of the above pages via command line
248+
{{< /alert-code >}}
249+
250+
244251
## 接下来的步骤
245252

246253
Most Selenium users execute many sessions and need to organize them to minimize duplication and keep the code
247-
more maintainable.
248-
To see these 8 components in a single script as part of a test runner,
249-
read on to learn about [Organizing and Executing Selenium in Tests]({{< ref "running_tests.md" >}}).
254+
more maintainable. Read on to learn about how to put this code into context for your use case with
255+
[Using Selenium]({{< ref "using_selenium.md" >}}).

0 commit comments

Comments
(0)

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