docs(protractor): add more protractor selectors (#9334)

Also fix `by.cssContainingText`, the text should not double quoted
This commit is contained in:
Jason Hu 2021-10-11 10:20:51 -07:00 committed by GitHub
parent 9dd6bb8c6a
commit 89e98d85fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,10 +16,13 @@ title: "Migrating from Protractor"
| Protractor | Playwright Test |
|---------------------------------------------------|-----------------------------------------|
| `element(by.model('...'))` | `page.locator('[ng-model="..."]')` |
| `element(by.buttonText('...'))` | `page.locator('button, input[type="button"], input[type="submit"] >> text="..."')` |
| `element(by.css('...'))` | `page.locator('...')` |
| `element(by.cssContainingText('..1..', '..2..'))` | `page.locator('..1.. >> text=..2..')` |
| `element(by.id('...'))` | `page.locator('#...')` |
| `element(by.model('...'))` | `page.locator('[ng-model="..."]')` |
| `element(by.repeater('...'))` | `page.locator('[ng-repeat="..."]')` |
| `element(by.cssContainingText('..1..', '..2..'))` | `page.locator('..1.. >> text="..2.."')` |
| `element(by.xpath('...'))` | `page.locator('xpath=...')` |
| `element.all` | `page.locator` |
| `browser.get(url)` | `await page.goto(url)` |
| `browser.getCurrentUrl()` | `page.url()` |