mirror of
https://github.com/microsoft/playwright-dotnet.git
synced 2026-10-28 22:05:13 +08:00
chore: get rid of Git submodule (#1853)
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
co-authored by
Dmitry Gozman
parent
53ccf22692
commit
b6ceeb79d8
@@ -1,33 +0,0 @@
|
||||
name: Integrity Checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release-*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release-*
|
||||
|
||||
jobs:
|
||||
verify_generated_files:
|
||||
name: Perform API Integrity Check
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.x
|
||||
- name: Install prerequisites and download drivers
|
||||
shell: pwsh
|
||||
run: .\build.ps1 driver -prereqs
|
||||
- name: Generate API
|
||||
run: .\build.ps1 roll
|
||||
shell: pwsh
|
||||
- name: Verify generated API is up to date
|
||||
run: git diff --exit-code
|
||||
@@ -27,9 +27,7 @@ jobs:
|
||||
dotnet-version: 5.0.x
|
||||
- name: Install prerequisites and download drivers
|
||||
shell: pwsh
|
||||
run: |
|
||||
.\build.ps1 driver -prereqs
|
||||
.\build.ps1 wwwroot
|
||||
run: ./build.ps1 driver -prereqs
|
||||
- name: Install Playwright CLI
|
||||
run: dotnet tool install --global Microsoft.Playwright.CLI
|
||||
- name: Build NUnit Package
|
||||
|
||||
@@ -26,9 +26,7 @@ jobs:
|
||||
dotnet-version: 5.0.x
|
||||
- name: Install prerequisites and download drivers
|
||||
shell: pwsh
|
||||
run: |
|
||||
./build.ps1 driver
|
||||
./build.ps1 wwwroot
|
||||
run: ./build.ps1 driver
|
||||
- name: Building...
|
||||
run: dotnet build ./src
|
||||
- name: Installing Browsers and dependencies...
|
||||
|
||||
@@ -31,9 +31,7 @@ jobs:
|
||||
dotnet-version: 5.0.x
|
||||
- name: Install prerequisites and download drivers
|
||||
shell: pwsh
|
||||
run: |
|
||||
./build.ps1 driver
|
||||
./build.ps1 wwwroot
|
||||
run: ./build.ps1 driver
|
||||
- name: Building...
|
||||
run: dotnet build ./src
|
||||
- name: Installing Browsers and dependencies...
|
||||
@@ -71,9 +69,7 @@ jobs:
|
||||
dotnet-version: 5.0.x
|
||||
- name: Install prerequisites and download drivers
|
||||
shell: pwsh
|
||||
run: |
|
||||
./build.ps1 driver
|
||||
./build.ps1 wwwroot
|
||||
run: ./build.ps1 driver
|
||||
- name: Building...
|
||||
run: |
|
||||
dotnet build -f netstandard2.0 ./src/Playwright/Playwright.csproj
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
[submodule "playwright"]
|
||||
path = playwright
|
||||
url = https://github.com/microsoft/playwright
|
||||
|
||||
+8
-18
@@ -80,7 +80,7 @@ if you have PowerShell installed on your system.
|
||||
When you get the repo, you need to initialize the submodules and download the driver to start work. To do this, you can call:
|
||||
|
||||
```ps
|
||||
.\build.ps1 driver -prereqs
|
||||
./build.ps1 driver -prereqs
|
||||
```
|
||||
|
||||
This will run the following commands:
|
||||
@@ -111,35 +111,25 @@ The resulting code will follow our style guides. This is also enforced in our CI
|
||||
Tests can either be executed in their entirety:
|
||||
|
||||
```powershell
|
||||
dotnet test .\src\Playwright.sln
|
||||
dotnet test ./src/Playwright.sln
|
||||
```
|
||||
|
||||
You can also specify a single test to run:
|
||||
|
||||
```powershell
|
||||
dotnet test .\src\Playwright.sln --filter Playwright.Tests.TapTests
|
||||
dotnet test ./src/Playwright.sln --filter Playwright.Tests.TapTests
|
||||
```
|
||||
|
||||
Additionally, you can use the Test Explorer if you're using Visual Studio.
|
||||
|
||||
### Generating the API & rolling the driver (upstream)
|
||||
### Generating the APIs & rolling the driver (upstream)
|
||||
|
||||
We use the [generator](https://github.com/microsoft/playwright/blob/master/utils/doclint/generateDotnetApi.js), located upstream, to generate the interfaces from the "single source of truth". To help us keep track of versions, this repository has a [submodule dependency](https://github.blog/2016-02-01-working-with-submodules/) to upstream.
|
||||
We use [this](https://github.com/microsoft/playwright/blob/master/utils/doclint/generateDotnetApi.js) generator for the API and [that](https://github.com/microsoft/playwright/blob/master/utils/generate_dotnet_channels.js) for generating the transport channels. Both are located upstream.
|
||||
|
||||
> Note: to simplify, this assumes you have PowerShell on your system. You can perform each of these steps manually, however.
|
||||
|
||||
To generate the API, identify the commit sha of the point in time you wish to roll to, and run
|
||||
To generate the API, identify the upstream driver version from the GitHub Actions logs of the point in time you wish to roll to, and run:
|
||||
|
||||
```powershell
|
||||
.\build.ps1 roll commitsha
|
||||
./build.ps1 roll <driver-version>
|
||||
```
|
||||
|
||||
This will essentially run the following:
|
||||
|
||||
```powershell
|
||||
cd playwright
|
||||
git checkout commitsha
|
||||
cd ..
|
||||
node "playwright/utils/doclint/generateDotnetApi.js" "src/Playwright"
|
||||
dotnet run --project ./src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath .
|
||||
```
|
||||
This will re-generate the neccessary files for the new driver version.
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->94.0.4595.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| WebKit <!-- GEN:webkit-version -->15.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->91.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Chromium <!-- GEN:chromium-version -->98.0.4695.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->94.0.1<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
|
||||
Playwright for .NET is the official language port of [Playwright](https://playwright.dev), the library to automate [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**.
|
||||
|
||||
|
||||
+11
-9
@@ -1,17 +1,19 @@
|
||||
# Rolling Playwright-dotnet to the latest Playwright driver
|
||||
|
||||
## Pre-requisites
|
||||
* remove old gen files: `find src/Playwright | grep Generated | xargs rm`
|
||||
* install dotnet with installer: https://dotnet.microsoft.com/download/dotnet/5.0
|
||||
* install dotnet format tool: `dotnet tool install -g dotnet-format`
|
||||
|
||||
* install .NET SDK 5 with installer: https://dotnet.microsoft.com/download/dotnet/5.0
|
||||
* install [PowerShell](https://github.com/PowerShell/PowerShell)
|
||||
|
||||
## Rolling
|
||||
* obtain the commit hash (long form) to where we're rolling to
|
||||
* in the repo folder, run
|
||||
|
||||
```powershell
|
||||
.\Build.ps1 roll <commit hash>
|
||||
```
|
||||
1. Checkout the upstream main/release branch of the `playwright` repository.
|
||||
1. Checkout the main/release branch of the `playwright-dotnet` repository.
|
||||
1. Pick the latest driver from GitHub Action where you want to roll to. For releases, it should be `v1.X.Y`. For main branch, it should be something like `v1.X.Y-<timestamp>`.
|
||||
1. By default it will pick `playwright` from `../playwright`. You can override it by setting the `PW_SRC_DIR` environment variable.
|
||||
|
||||
This will complete the entire process including replacing the version number and downloading drivers.
|
||||
```powershell
|
||||
./build.ps1 roll <driver-version>
|
||||
```
|
||||
|
||||
This will complete the entire process (downnload and set the new driver, re-generate API and transport channels, update the README).
|
||||
|
||||
@@ -3,46 +3,33 @@
|
||||
[CmdletBinding(PositionalBinding = $false)]
|
||||
Param(
|
||||
[Parameter(ValueFromRemainingArguments = $true)][String[]]$verbs,
|
||||
[Switch]$reset,
|
||||
[Switch]$prereqs
|
||||
)
|
||||
|
||||
$upstream_repo_path = Join-Path -Path ".." -ChildPath "playwright"
|
||||
if ($env:PW_SRC_DIR -ne $null) {
|
||||
$upstream_repo_path = $env:PW_SRC_DIR
|
||||
}
|
||||
Write-Host "Upstream repo path: $upstream_repo_path"
|
||||
|
||||
function Get-Help() {
|
||||
Write-Host "Actions (defaults to help):"
|
||||
Write-Host "Commands:"
|
||||
Write-Host " init Performs the initalization of the repository, and installs/downloads"
|
||||
Write-Host " all the required artifacts (i.e. driver), and initializes the submodule."
|
||||
Write-Host " -reset Forces the submodule to be updated."
|
||||
Write-Host " all the required artifacts (i.e. driver)."
|
||||
Write-Host " -prereqs Installs all the required prerequisites and dev certificates."
|
||||
Write-Host ""
|
||||
Write-Host " roll [commit sha] Moves the submodule to the commit specified, generates the API, and downloads"
|
||||
Write-Host " downloads the new driver."
|
||||
Write-Host " roll <driver-version> Updates the API version, downloads driver, generates the API, and transport interfaces."
|
||||
Write-Host " driver Downloads the driver."
|
||||
Write-Host " help Prints this message."
|
||||
Write-Host " wwwroot Copies over the wwwroot."
|
||||
}
|
||||
|
||||
function Invoke-Init() {
|
||||
Invoke-InitializeSubmodule
|
||||
if ($prereqs) { Invoke-InstallRequirements }
|
||||
Invoke-DownloadDriver
|
||||
Invoke-WWWRoot
|
||||
}
|
||||
|
||||
function Get-SubmoduleStatus() {
|
||||
$smStatus = git submodule status
|
||||
return $smStatus
|
||||
}
|
||||
|
||||
function Invoke-InitializeSubmodule($enableReset = $true) {
|
||||
# Check the status of the submodule, if not initialized, let's do that
|
||||
if ((Get-SubmoduleStatus).StartsWith("-") -or ($enableReset -and $reset)) {
|
||||
Write-Host "🔨 Initializing git submodule..." -NoNewline
|
||||
git submodule update --init >$null 2>&1
|
||||
if ((Get-SubmoduleStatus).StartsWith("-")) { throw 'Could not initialize git submodule' }
|
||||
Write-Host "`r✅ Finished initializing git submodule."
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-InstallRequirements() {
|
||||
Write-Host "🔨 Installing requirements..." -NoNewline
|
||||
dotnet tool install --global dotnet-format >$null 2>&1
|
||||
@@ -51,58 +38,37 @@ function Invoke-InstallRequirements() {
|
||||
}
|
||||
|
||||
function Invoke-DownloadDriver() {
|
||||
# We need the submodule to be initialized for this, so we're forcing the check
|
||||
Invoke-InitializeSubmodule $false
|
||||
if ($prereqs) { Invoke-InstallRequirements }
|
||||
Write-Host "🚀 Downloading drivers..." -NoNewline
|
||||
dotnet run --project ./src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath .
|
||||
}
|
||||
|
||||
function Invoke-WWWRoot() {
|
||||
function Invoke-UpdateWWWRoot() {
|
||||
Write-Host "🌐 Synchronizing wwwroot folder..."
|
||||
Remove-Item -Path .\src\Playwright.Tests.TestServer\wwwroot\ -Recurse -Force
|
||||
Copy-Item -Path .\playwright\tests\assets -Destination .\src\Playwright.Tests.TestServer\wwwroot\ -Recurse
|
||||
$dotnet_wwwroot_path = "./src/Playwright.Tests.TestServer/wwwroot"
|
||||
Remove-Item -Path "$dotnet_wwwroot_path" -Recurse -Force
|
||||
Copy-Item -Path "$upstream_repo_path/tests/assets" -Destination $dotnet_wwwroot_path -Recurse
|
||||
}
|
||||
|
||||
function Invoke-Roll() {
|
||||
if ($verbs.Length -eq 2) {
|
||||
if ((Get-SubmoduleStatus).StartsWith("+")) {
|
||||
$decision = $Host.UI.PromptForChoice("Update Submodule",
|
||||
"The Submodule is already at a different commit, do you want to still use the new sha?",
|
||||
@('&Yes, update', "E&xit"),
|
||||
0)
|
||||
if ($decision -eq 1) {
|
||||
Write-Host "⚠ Stopping roll."
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Invoke-InitializeSubmodule
|
||||
}
|
||||
$new_driver_version = $verbs[1];
|
||||
$package = Get-Content "$upstream_repo_path/package.json" | ConvertFrom-Json
|
||||
$upstream_package_version = $package.version
|
||||
|
||||
Push-Location "playwright"
|
||||
Write-Host "🚀 Moving submodule to" $verbs[1]
|
||||
git fetch
|
||||
git checkout $verbs[1]
|
||||
$rev = (git show -s --format=%ct HEAD) + '000'
|
||||
Pop-Location
|
||||
Write-Host "🚀 Rolling .NET to driver $new_driver_version and upstream version $upstream_package_version"
|
||||
|
||||
$package = Get-Content "playwright/package.json" | ConvertFrom-Json
|
||||
|
||||
# Let's update the project file
|
||||
[xml]$version = Get-Content ".\src\Common\Version.props"
|
||||
$version.Project.PropertyGroup.DriverVersion = $package.version + "-" + $rev
|
||||
$version.Project.PropertyGroup.AssemblyVersion = $package.version.Split("-")[0]
|
||||
"Updating to " + $package.version + "-" + $rev
|
||||
$version.Save([IO.Path]::Combine($pwd, 'src', 'Common', 'Version.props'))
|
||||
} else {
|
||||
Invoke-InitializeSubmodule
|
||||
}
|
||||
# Let's update the project file
|
||||
[xml]$version = Get-Content "./src/Common/Version.props"
|
||||
$version.Project.PropertyGroup.DriverVersion = $new_driver_version
|
||||
$version.Save([IO.Path]::Combine($pwd, 'src', 'Common', 'Version.props'))
|
||||
|
||||
Write-Host "🚀 Generating API..."
|
||||
node "playwright/utils/doclint/generateDotnetApi.js" "src/Playwright"
|
||||
node "$upstream_repo_path/utils/doclint/generateDotnetApi.js" "src/Playwright"
|
||||
Write-Host "🚀 Generating transport channels..."
|
||||
Remove-Item -Path "src/Playwright/Transport/Protocol/Generated/" -Recurse -Force
|
||||
node "$upstream_repo_path/utils/generate_dotnet_channels.js" "src/Playwright"
|
||||
Invoke-DownloadDriver
|
||||
Invoke-WWWRoot
|
||||
Invoke-UpdateWWWRoot
|
||||
}
|
||||
|
||||
if ($verbs.Length -eq 0) {
|
||||
@@ -115,5 +81,5 @@ switch ($verbs[0]) {
|
||||
"help" { Get-Help }
|
||||
"roll" { Invoke-Roll }
|
||||
"driver" { Invoke-DownloadDriver }
|
||||
"wwwroot" { Invoke-WWWRoot }
|
||||
"wwwroot" { Invoke-UpdateWWWRoot }
|
||||
}
|
||||
-1
Submodule playwright deleted from 7af0dc178b
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>1.17.0</AssemblyVersion>
|
||||
<AssemblyVersion>1.17.1</AssemblyVersion>
|
||||
<PackageVersion>$(AssemblyVersion)-next-1</PackageVersion>
|
||||
<DriverVersion>1.17.0-1637048540000</DriverVersion>
|
||||
<DriverVersion>1.17.1</DriverVersion>
|
||||
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
<NoDefaultExcludes>true</NoDefaultExcludes>
|
||||
|
||||
@@ -72,10 +72,7 @@ namespace Microsoft.Playwright.Tests
|
||||
await Page.TapAsync("#b", new() { Trial = true });
|
||||
|
||||
string[] result = await handle.JsonValueAsync<string[]>();
|
||||
Assert.AreEqual(result, new string[] {
|
||||
"pointerover", "pointerenter",
|
||||
"pointerout", "pointerleave",
|
||||
});
|
||||
Assert.AreEqual(result, new string[] { });
|
||||
}
|
||||
|
||||
[PlaywrightTest("tap.spec.ts", "should not send mouse events touchstart is canceled")]
|
||||
|
||||
@@ -86,10 +86,8 @@ namespace Microsoft.Playwright
|
||||
/// <remarks>
|
||||
/// Inherits from <see cref="IJSHandle"/>
|
||||
/// <para>
|
||||
/// In most cases, you would want to use the <see cref="ILocator"/> object instead.
|
||||
/// You should only use <see cref="IElementHandle"/> if you want to retain a handle
|
||||
/// to a particular DOM Node that you intend to pass into <see cref="IPage.EvaluateAsync"/>
|
||||
/// as an argument.
|
||||
/// The use of ElementHandle is discouraged, use <see cref="ILocator"/> objects and
|
||||
/// web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public partial interface IElementHandle : IJSHandle
|
||||
|
||||
@@ -316,6 +316,13 @@ namespace Microsoft.Playwright
|
||||
/// var html = await frame.EvalOnSelectorAsync(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello");
|
||||
/// </code>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method does not wait for the element to pass actionability checks and therefore
|
||||
/// can lead to the flaky tests. Use <see cref="ILocator.EvaluateAsync"/>, other <see
|
||||
/// cref="ILocator"/> helper methods or web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -343,6 +350,12 @@ namespace Microsoft.Playwright
|
||||
/// <para>Examples:</para>
|
||||
/// <code>var divsCount = await frame.EvalOnSelectorAllAsync<bool>("div", "(divs, min) => divs.length >= min", 10);</code>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// In most cases, <see cref="ILocator.EvaluateAllAsync"/>, other <see cref="ILocator"/>
|
||||
/// helper methods and web-first assertions do a better job.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -379,7 +392,7 @@ namespace Microsoft.Playwright
|
||||
/// cref="IFrame.EvaluateAsync"/>:
|
||||
/// </para>
|
||||
/// <code>
|
||||
/// var bodyHandle = await frame.QuerySelectorAsync("body");<br/>
|
||||
/// var bodyHandle = await frame.EvaluateAsync("document.body");<br/>
|
||||
/// var html = await frame.EvaluateAsync<string>("([body, suffix]) => body.innerHTML + suffix", new object [] { bodyHandle, "hello" });<br/>
|
||||
/// await bodyHandle.DisposeAsync();
|
||||
/// </code>
|
||||
@@ -776,6 +789,12 @@ namespace Microsoft.Playwright
|
||||
/// match the selector, returns <c>null</c>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The use of <see cref="IElementHandle"/> is discouraged, use <see cref="ILocator"/>
|
||||
/// objects and web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -791,6 +810,12 @@ namespace Microsoft.Playwright
|
||||
/// elements match the selector, returns empty array.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The use of <see cref="IElementHandle"/> is discouraged, use <see cref="ILocator"/>
|
||||
/// objects instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -1449,6 +1474,12 @@ namespace Microsoft.Playwright
|
||||
/// }
|
||||
/// </code>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Playwright automatically waits for element to be ready before performing an action.
|
||||
/// Using <see cref="ILocator"/> objects and web-first assertions make the code wait-for-selector-free.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
|
||||
@@ -590,6 +590,13 @@ namespace Microsoft.Playwright
|
||||
/// </code>
|
||||
/// <para>Shortcut for main frame's <see cref="IFrame.EvalOnSelectorAsync"/>.</para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method does not wait for the element to pass actionability checks and therefore
|
||||
/// can lead to the flaky tests. Use <see cref="ILocator.EvaluateAsync"/>, other <see
|
||||
/// cref="ILocator"/> helper methods or web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -616,6 +623,12 @@ namespace Microsoft.Playwright
|
||||
/// <para>Examples:</para>
|
||||
/// <code>var divsCount = await page.EvalOnSelectorAllAsync<bool>("div", "(divs, min) => divs.length >= min", 10);</code>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// In most cases, <see cref="ILocator.EvaluateAllAsync"/>, other <see cref="ILocator"/>
|
||||
/// helper methods and web-first assertions do a better job.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -653,7 +666,7 @@ namespace Microsoft.Playwright
|
||||
/// cref="IPage.EvaluateAsync"/>:
|
||||
/// </para>
|
||||
/// <code>
|
||||
/// var bodyHandle = await page.QuerySelectorAsync("body");<br/>
|
||||
/// var bodyHandle = await page.EvaluateAsync("document.body");<br/>
|
||||
/// var html = await page.EvaluateAsync<string>("([body, suffix]) => body.innerHTML + suffix", new object [] { bodyHandle, "hello" });<br/>
|
||||
/// await bodyHandle.DisposeAsync();
|
||||
/// </code>
|
||||
@@ -1304,10 +1317,16 @@ namespace Microsoft.Playwright
|
||||
/// <para>
|
||||
/// The method finds an element matching the specified selector within the page. If
|
||||
/// no elements match the selector, the return value resolves to <c>null</c>. To wait
|
||||
/// for an element on the page, use <see cref="IPage.WaitForSelectorAsync"/>.
|
||||
/// for an element on the page, use <see cref="ILocator.WaitForAsync"/>.
|
||||
/// </para>
|
||||
/// <para>Shortcut for main frame's <see cref="IFrame.QuerySelectorAsync"/>.</para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The use of <see cref="IElementHandle"/> is discouraged, use <see cref="ILocator"/>
|
||||
/// objects and web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -1322,6 +1341,12 @@ namespace Microsoft.Playwright
|
||||
/// </para>
|
||||
/// <para>Shortcut for main frame's <see cref="IFrame.QuerySelectorAllAsync"/>.</para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The use of <see cref="IElementHandle"/> is discouraged, use <see cref="ILocator"/>
|
||||
/// objects and web-first assertions instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
@@ -2781,6 +2806,12 @@ namespace Microsoft.Playwright
|
||||
/// }
|
||||
/// </code>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Playwright automatically waits for element to be ready before performing an action.
|
||||
/// Using <see cref="ILocator"/> objects and web-first assertions make the code wait-for-selector-free.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="selector">
|
||||
/// A selector to query for. See <a href="./selectors.md">working with selectors</a>
|
||||
/// for more details.
|
||||
|
||||
@@ -67,11 +67,11 @@ namespace Microsoft.Playwright
|
||||
/// var page = await browser.NewPageAsync();<br/>
|
||||
/// await page.SetContentAsync("<div><button>Click me</button></div>");<br/>
|
||||
/// // Use the selector prefixed with its name.<br/>
|
||||
/// var button = await page.QuerySelectorAsync("tag=button");<br/>
|
||||
/// var button = page.Locator("tag=button");<br/>
|
||||
/// // Combine it with other selector engines.<br/>
|
||||
/// await page.ClickAsync("tag=div >> text=\"Click me\"");<br/>
|
||||
/// // Can use it in any methods supporting selectors.<br/>
|
||||
/// int buttonCount = await page.EvalOnSelectorAllAsync<int>("tag=button", "buttons => buttons.length");
|
||||
/// int buttonCount = await page.Locator("tag=button").CountAsync();
|
||||
/// </code>
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
|
||||
+1
-5
@@ -23,14 +23,10 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class SocksSocketInitializer
|
||||
internal class APIRequestContextInitializer
|
||||
{
|
||||
public string DstAddr { get; set; }
|
||||
|
||||
public int DstPort { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,10 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class AndroidDeviceInitializer
|
||||
internal class AndroidDeviceInitializer : EventTargetInitializer
|
||||
{
|
||||
public string Model { get; set; }
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,18 +23,17 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class BindingCallInitializer
|
||||
{
|
||||
public Frame Frame { get; set; }
|
||||
public Core.Frame Frame { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<System.Text.Json.JsonElement> Args { get; set; }
|
||||
|
||||
public JSHandle Handle { get; set; }
|
||||
public Core.JSHandle Handle { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class BrowserContextInitializer
|
||||
internal class BrowserContextInitializer : EventTargetInitializer
|
||||
{
|
||||
public bool IsChromium { get; set; }
|
||||
|
||||
// public Core.APIRequestContext APIRequestContext { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
@@ -33,7 +32,7 @@ namespace Microsoft.Playwright.Transport.Protocol
|
||||
|
||||
public string Text { get; set; }
|
||||
|
||||
public List<JSHandle> Args { get; set; }
|
||||
public List<Core.JSHandle> Args { get; set; }
|
||||
|
||||
public ConsoleMessageLocation Location { get; set; }
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,12 +23,11 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class ElectronApplicationInitializer
|
||||
internal class ElectronApplicationInitializer : EventTargetInitializer
|
||||
{
|
||||
public BrowserContext Context { get; set; }
|
||||
public Core.BrowserContext Context { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class EventTargetInitializer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
@@ -33,7 +32,7 @@ namespace Microsoft.Playwright.Transport.Protocol
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public Frame ParentFrame { get; set; }
|
||||
public Core.Frame ParentFrame { get; set; }
|
||||
|
||||
public List<WaitUntilState> LoadStates { get; set; }
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class JsonPipeInitializer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -23,18 +23,17 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class PageInitializer
|
||||
internal class PageInitializer : EventTargetInitializer
|
||||
{
|
||||
public Frame MainFrame { get; set; }
|
||||
public Core.Frame MainFrame { get; set; }
|
||||
|
||||
public ViewportSize ViewportSize { get; set; }
|
||||
|
||||
public bool IsClosed { get; set; }
|
||||
|
||||
public Page Opener { get; set; }
|
||||
public Core.Page Opener { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class RequestInitializer
|
||||
{
|
||||
public Frame Frame { get; set; }
|
||||
public Core.Frame Frame { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
@@ -43,6 +42,6 @@ namespace Microsoft.Playwright.Transport.Protocol
|
||||
|
||||
public bool IsNavigationRequest { get; set; }
|
||||
|
||||
public Request RedirectedFrom { get; set; }
|
||||
public Core.Request RedirectedFrom { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class ResponseInitializer
|
||||
{
|
||||
public Request Request { get; set; }
|
||||
public Core.Request Request { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
@@ -37,8 +36,6 @@ namespace Microsoft.Playwright.Transport.Protocol
|
||||
|
||||
public string StatusText { get; set; }
|
||||
|
||||
public List<HeaderEntry> RequestHeaders { get; set; }
|
||||
|
||||
public List<HeaderEntry> Headers { get; set; }
|
||||
|
||||
public RequestTimingResult Timing { get; set; }
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class RootInitializer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,11 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class RouteInitializer
|
||||
{
|
||||
public Request Request { get; set; }
|
||||
public Core.Request Request { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -23,11 +23,10 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
internal class WebSocketInitializer
|
||||
internal class WebSocketInitializer : EventTargetInitializer
|
||||
{
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Playwright.Core;
|
||||
|
||||
namespace Microsoft.Playwright.Transport.Protocol
|
||||
{
|
||||
|
||||
@@ -73,24 +73,8 @@ namespace Playwright.Tooling
|
||||
|
||||
var regex = new Regex("<!-- GEN:(.*?) -->(.*?)<!-- GEN:stop -->", RegexOptions.Compiled);
|
||||
|
||||
// get commit hash
|
||||
var gitInfo = new ProcessStartInfo
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
FileName = "git",
|
||||
CreateNoWindow = true,
|
||||
WorkingDirectory = Path.Combine(BasePath, "playwright"),
|
||||
Arguments = "rev-parse HEAD",
|
||||
};
|
||||
|
||||
var gitProcess = Process.Start(gitInfo);
|
||||
gitProcess.WaitForExit();
|
||||
var hash = (await gitProcess.StandardOutput.ReadToEndAsync().ConfigureAwait(false))?.Trim();
|
||||
var client = new HttpClient();
|
||||
string readmeUrl = $"https://github.com/microsoft/playwright/blob/{hash}/README.md";
|
||||
var readme = await client.GetStringAsync(readmeUrl).ConfigureAwait(false);
|
||||
|
||||
var basePlaywrightDir = Environment.GetEnvironmentVariable("PW_SRC_DIR") ?? Path.Combine(Environment.CurrentDirectory, "..", "playwright");
|
||||
var readme = File.ReadAllText(Path.Combine(basePlaywrightDir, "README.md"));
|
||||
static string ReplaceBrowserVersion(string content, MatchCollection browserMatches)
|
||||
{
|
||||
foreach (Match match in browserMatches)
|
||||
@@ -118,7 +102,15 @@ namespace Playwright.Tooling
|
||||
private async Task DownloadDriverAsync(DirectoryInfo destinationDirectory, string driverVersion, string platform)
|
||||
{
|
||||
Console.WriteLine("Downloading driver for " + platform);
|
||||
string cdn = "https://playwright.azureedge.net/builds/driver/next";
|
||||
string cdn = "https://playwright.azureedge.net/builds/driver";
|
||||
if (
|
||||
driverVersion.Contains("-alpha")
|
||||
|| driverVersion.Contains("-beta")
|
||||
|| driverVersion.Contains("-next")
|
||||
)
|
||||
{
|
||||
cdn += "/next";
|
||||
}
|
||||
|
||||
using var client = new HttpClient();
|
||||
string url = $"{cdn}/playwright-{driverVersion}-{platform}.zip";
|
||||
|
||||
Reference in New Issue
Block a user