Skip to content

Commit

Permalink
Update Opera Sample (#1065)[deploy site]
Browse files Browse the repository at this point in the history
Update Opera Sample by SeleniumHQ/selenium#10835
  • Loading branch information
alaahong authored Jul 4, 2022
1 parent 37d9151 commit 33edfd4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ public void internetExplorerCompatibilitySession() {
@Disabled("Requires non-standard browser")
@Test
public void operaSession() {
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera/browser");

driver = new ChromeDriver(options);

// Set webdriver.chrome.driver with Opera Driver
System.setProperty("webdriver.chrome.driver", "OPERA_DRIVER_PATH");
// Create ChromeOptions Instance
chromeOptions = new ChromeOptions();
// Set W3C Dialect
chromeOptions.setExperimentalOption("w3c", true);
// Create ChromeDriver Instance
driver = new ChromeDriver(chromeOptions);
// Open Target Website
driver.get("https://www.selenium.dev");
// Quit
driver.quit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,24 @@ Microsoft Edge can be used in IE compatibility mode using the IE Driver.

## Opera

Since the opera driver does not support w3c syntax, but is based on Chromium, it is recommended
Since the opera driver does not set w3c as default value, but is based on Chromium, it is recommended
to drive Opera browser with the chromedriver. Like all Chromium implementations,
make sure that the browser version matches the driver version.

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L78">}}
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera/browser");

driver = new ChromeDriver(options);

driver.quit();
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L84">}}
// Set webdriver.chrome.driver with Opera Driver
System.setProperty("webdriver.chrome.driver", "OPERA_DRIVER_PATH");
// Create ChromeOptions Instance
ChromeOptions chromeOptions = new ChromeOptions();
// Set W3C Dialect
chromeOptions.setExperimentalOption("w3c", true);
// Create ChromeDriver Instance
WebDriver driver = new ChromeDriver(chromeOptions);
// Open Target Website
driver.get("https://www.selenium.dev");
// Quit
driver.quit();
{{< /tab >}}
{{< tab header="Python" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/python/tests/getting_started/test_open_browser.py#L49-L53" >}}
options = ChromeOptions()
Expand Down Expand Up @@ -344,7 +350,7 @@ safaridriver --enable
```

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L84-L88">}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L90-L94">}}
SafariOptions options = new SafariOptions();
driver = new SafariDriver(options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,23 @@ Microsoft Edge can be used in IE compatibility mode using the IE Driver.

## Opera

Since the opera driver does not support w3c syntax, but is based on Chromium, it is recommended
to drive Opera browser with the chromedriver. Like all Chromium implementations,
Since the opera driver does not set w3c as default value, but is based on Chromium, it is recommended
to drive Opera browser with the chromedriver. Like all Chromium implementations,
make sure that the browser version matches the driver version.

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L78">}}
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera/browser");

driver = new ChromeDriver(options);

{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L84">}}
// Set webdriver.chrome.driver with Opera Driver
System.setProperty("webdriver.chrome.driver", "OPERA_DRIVER_PATH");
// Create ChromeOptions Instance
ChromeOptions chromeOptions = new ChromeOptions();
// Set W3C Dialect
chromeOptions.setExperimentalOption("w3c", true);
// Create ChromeDriver Instance
WebDriver driver = new ChromeDriver(chromeOptions);
// Open Target Website
driver.get("https://www.selenium.dev");
// Quit
driver.quit();
{{< /tab >}}
{{< tab header="Python" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/python/tests/getting_started/test_open_browser.py#L49-L53" >}}
Expand Down Expand Up @@ -345,7 +351,7 @@ safaridriver --enable
```

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L84-L88">}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L90-L94">}}
SafariOptions options = new SafariOptions();
driver = new SafariDriver(options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,23 @@ O Microsoft Edge pode ser usado no modo de compatibilidade do IE usando o Driver

## Opera

Como o driver opera não suporta a sintaxe w3c, mas é baseado no Chromium, é recomendado
Porque o driver opera não define W3C como a sintaxe padrão, mas é baseado no Chromium, é recomendado
utilizar o navegador Opera com o chromedriver. Assim como todas as implementações do Chromium,
certifique-se de que a versão do navegador corresponda à versão do driver.

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L78">}}
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera/browser");

driver = new ChromeDriver(options);

{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L84">}}
// Set webdriver.chrome.driver with Opera Driver
System.setProperty("webdriver.chrome.driver", "OPERA_DRIVER_PATH");
// Create ChromeOptions Instance
ChromeOptions chromeOptions = new ChromeOptions();
// Set W3C Dialect
chromeOptions.setExperimentalOption("w3c", true);
// Create ChromeDriver Instance
WebDriver driver = new ChromeDriver(chromeOptions);
// Open Target Website
driver.get("https://www.selenium.dev");
// Quit
driver.quit();
{{< /tab >}}
{{< tab header="Python" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/python/tests/getting_started/test_open_browser.py#L49-L53" >}}
Expand Down Expand Up @@ -337,7 +343,7 @@ safaridriver --enable
```

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L84-L88">}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L90-L94">}}
SafariOptions options = new SafariOptions();
driver = new SafariDriver(options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,23 @@ Internet Explorer 11将于2022年6月15日终止对包括Windows 10在内的某

## Opera

由于opera驱动程序不支持w3c语法,
由于opera驱动程序未设置w3c为默认语法,
但基于Chrome, 因此建议使用chromedriver驱动opera浏览器.
与所有Chromium实现一样, 确保浏览器版本与驱动程序版本匹配.

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L78">}}
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera/browser");

driver = new ChromeDriver(options);

{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L73-L84">}}
// Set webdriver.chrome.driver with Opera Driver
System.setProperty("webdriver.chrome.driver", "OPERA_DRIVER_PATH");
// Create ChromeOptions Instance
ChromeOptions chromeOptions = new ChromeOptions();
// Set W3C Dialect
chromeOptions.setExperimentalOption("w3c", true);
// Create ChromeDriver Instance
WebDriver driver = new ChromeDriver(chromeOptions);
// Open Target Website
driver.get("https://www.selenium.dev");
// Quit
driver.quit();
{{< /tab >}}
{{< tab header="Python" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/python/tests/getting_started/test_open_browser.py#L49-L53" >}}
Expand Down Expand Up @@ -347,7 +353,7 @@ safaridriver --enable
```

{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L84-L88">}}
{{< tab header="Java" github="SeleniumHQ/seleniumhq.github.io/blob/dev/examples/java/src/test/java/dev/selenium/getting_started/OpenBrowserTest.java#L90-L94">}}
SafariOptions options = new SafariOptions();
driver = new SafariDriver(options);

Expand Down

0 comments on commit 33edfd4

Please sign in to comment.