Skip to content

Commit

Permalink
Merge branch 'trunk' into translate
Browse files Browse the repository at this point in the history
  • Loading branch information
alaahong committed Sep 29, 2023
2 parents 3676b92 + 6e4b841 commit e3bdc68
Show file tree
Hide file tree
Showing 270 changed files with 7,350 additions and 4,806 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/dotnet-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,33 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=${{ steps.setup-edge.outputs.edge-path }}" >> $env:GITHUB_ENV
- name: Set ENV Other
if: matrix.os != 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=${{ steps.setup-edge.outputs.edge-path }}" >> "$GITHUB_ENV"
echo "FF_BIN=${{ steps.setup-firefox.outputs.firefox-path }}" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/java-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" >> $env:GITHUB_ENV
echo "FF_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox-browser.exe" >> $env:GITHUB_ENV
- name: Set ENV Mac
if: matrix.os == 'macos-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/Users/runner/hostedtoolcache/msedge/stable/x64/Contents/MacOS/Microsoft Edge" >> "$GITHUB_ENV"
echo "FF_BIN=/Users/runner/hostedtoolcache/firefox/latest/x64/Contents/MacOS/firefox" >> "$GITHUB_ENV"
- name: Set ENV Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/opt/hostedtoolcache/msedge/stable/x64/msedge" >> "$GITHUB_ENV"
echo "FF_BIN=/opt/hostedtoolcache/firefox/latest/x64/firefox" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/js-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" >> $env:GITHUB_ENV
echo "FF_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox-browser.exe" >> $env:GITHUB_ENV
- name: Set ENV Mac
if: matrix.os == 'macos-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/Users/runner/hostedtoolcache/msedge/stable/x64/Contents/MacOS/Microsoft Edge" >> "$GITHUB_ENV"
echo "FF_BIN=/Users/runner/hostedtoolcache/firefox/latest/x64/Contents/MacOS/firefox" >> "$GITHUB_ENV"
- name: Set ENV Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/opt/hostedtoolcache/msedge/stable/x64/msedge" >> "$GITHUB_ENV"
echo "FF_BIN=/opt/hostedtoolcache/firefox/latest/x64/firefox" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/kotlin-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" >> $env:GITHUB_ENV
echo "FF_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox-browser.exe" >> $env:GITHUB_ENV
- name: Set ENV Mac
if: matrix.os == 'macos-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/Users/runner/hostedtoolcache/msedge/stable/x64/Contents/MacOS/Microsoft Edge" >> "$GITHUB_ENV"
echo "FF_BIN=/Users/runner/hostedtoolcache/firefox/latest/x64/Contents/MacOS/firefox" >> "$GITHUB_ENV"
- name: Set ENV Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/opt/hostedtoolcache/msedge/stable/x64/msedge" >> "$GITHUB_ENV"
echo "FF_BIN=/opt/hostedtoolcache/firefox/latest/x64/firefox" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/python-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" >> $env:GITHUB_ENV
echo "FF_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox-browser.exe" >> $env:GITHUB_ENV
- name: Set ENV Mac
if: matrix.os == 'macos-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/Users/runner/hostedtoolcache/msedge/stable/x64/Contents/MacOS/Microsoft Edge" >> "$GITHUB_ENV"
echo "FF_BIN=/Users/runner/hostedtoolcache/firefox/latest/x64/Contents/MacOS/firefox" >> "$GITHUB_ENV"
- name: Set ENV Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/opt/hostedtoolcache/msedge/stable/x64/msedge" >> "$GITHUB_ENV"
echo "FF_BIN=/opt/hostedtoolcache/firefox/latest/x64/firefox" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ruby-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ jobs:
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3
- name: Install Chrome for set binary test
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- name: Install Edge for set binary test
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
id: setup-edge
- name: Install Firefox for set binary test
if: matrix.os != 'windows-latest'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
id: setup-firefox
- name: Set ENV Windows
if: matrix.os == 'windows-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
echo "EDGE_BIN=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" >> $env:GITHUB_ENV
echo "FF_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox-browser.exe" >> $env:GITHUB_ENV
- name: Set ENV Mac
if: matrix.os == 'macos-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/Users/runner/hostedtoolcache/msedge/stable/x64/Contents/MacOS/Microsoft Edge" >> "$GITHUB_ENV"
echo "FF_BIN=/Users/runner/hostedtoolcache/firefox/latest/x64/Contents/MacOS/firefox" >> "$GITHUB_ENV"
- name: Set ENV Linux
if: matrix.os == 'ubuntu-latest'
run: |
echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV"
echo "EDGE_BIN=/opt/hostedtoolcache/msedge/stable/x64/msedge" >> "$GITHUB_ENV"
echo "FF_BIN=/opt/hostedtoolcache/firefox/latest/x64/firefox" >> "$GITHUB_ENV"
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: Xvfb :99 &
Expand Down
76 changes: 76 additions & 0 deletions examples/dotnet/SeleniumDocs/Bidirectional/BidiApiTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;

namespace SeleniumDocs.Bidirectional
{
[TestClass]
public class BidiApiTest : BaseChromeTest
{
[TestMethod]
public async Task InterceptNetworkForAuthentication()
{
var handler = new NetworkAuthenticationHandler()
{
UriMatcher = _ => true,
Credentials = new PasswordCredentials("admin", "admin")
};

INetwork networkInterceptor = driver.Manage().Network;
networkInterceptor.AddAuthenticationHandler(handler);

await networkInterceptor.StartMonitoring();
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/basic_auth");
await networkInterceptor.StopMonitoring();

Assert.AreEqual("Congratulations! You must have the proper credentials.", driver.FindElement(By.TagName("p")).Text);

}

[TestMethod]
public async Task InterceptNetworkResponse()
{
var handler = new NetworkResponseHandler()
{
ResponseMatcher = httpresponse => true,
ResponseTransformer = http => new()
{
StatusCode = 200,
Body = "Creamy, delicious cheese!"
}
};

INetwork networkInterceptor = driver.Manage().Network;
networkInterceptor.AddResponseHandler(handler);

await networkInterceptor.StartMonitoring();
driver.Navigate().GoToUrl("https://www.selenium.dev");
await networkInterceptor.StopMonitoring();

StringAssert.Contains(driver.PageSource, "delicious cheese");
}

[TestMethod]
public async Task InterceptNetworkRequest()
{
var handler = new NetworkRequestHandler()
{
RequestMatcher = httprequest => true,
ResponseSupplier = http => new()
{
StatusCode = 200,
Body = "Creamy, delicious cheese!"
}
};

INetwork networkInterceptor = driver.Manage().Network;
networkInterceptor.AddRequestHandler(handler);

await networkInterceptor.StartMonitoring();
driver.Navigate().GoToUrl("https://www.selenium.dev");
await networkInterceptor.StopMonitoring();

StringAssert.Contains(driver.PageSource, "delicious cheese");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SeleniumDocs.Bidirectional.BidirectionalW3c
{
[TestClass]
public class BrowsingContextTest : BaseTest
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SeleniumDocs.Bidirectional.BidirectionalW3c
{
[TestClass]
public class LogTest : BaseTest
{

}
}
10 changes: 10 additions & 0 deletions examples/dotnet/SeleniumDocs/Bidirectional/ChromeDevtoolsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SeleniumDocs.Bidirectional
{
[TestClass]
public class ChomeDevtoolsTest : BaseTest
{

}
}

0 comments on commit e3bdc68

Please sign in to comment.