From c5fb5c5c88817056b92d84f238fc468998bd9263 Mon Sep 17 00:00:00 2001 From: Rannes Date: Thu, 17 Oct 2024 13:36:23 +0700 Subject: [PATCH] remove docs folder and files --- docs/AG0042.md | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 docs/AG0042.md diff --git a/docs/AG0042.md b/docs/AG0042.md deleted file mode 100644 index eb9d42d..0000000 --- a/docs/AG0042.md +++ /dev/null @@ -1,37 +0,0 @@ -# AG0042: QuerySelectorAsync should not be used - -This rule detect if the method QuerySelectorAsync is used in the code. -As the method is not recommended by the library, then we shouldn't use it. - -## Description - -Reading the [official document](https://playwright.dev/dotnet/docs/api/class-elementhandle), it says this: -``` -The use of ElementHandle is discouraged, use Locator objects and web-first assertions instead. -``` - -## How to fix -Use [Page.Locator](https://playwright.dev/docs/locators) instead, which is the recommended way to interact with the page. -We cannot do the codefix for it, as it's not directly 1-to-1 replacement, but usually the replacement is easy. - -## Examples - -``` -DO: -_page.Locator("[data-testid='toast-example']") - -DO NOT: -_page.QuerySelectorAsync($"[data-testid='toast-example']") -``` - -``` -DO: -_page.Locator($"[data-element-name='dropdown-example']") - -DO NOT: -var dropdown = await _page.QuerySelectorAsync($"[data-element-name='dropdown-example']"); -if (dropdown == null) -{ - throw new Exception($"Dropdown with data-element-name 'dropdown-example' not found."); -} -``` \ No newline at end of file