Skip to content

Commit 4733898

Browse files
Updated tutorial part 2 instructions
1 parent 376f98d commit 4733898

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tutorial/2-first-steps.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Part 2: First steps with Playwright
22

3-
Part 2 of the workshop shows how to take your first steps with Playwright calls.
3+
Part 2 of the tutorial shows how to take your first steps with Playwright calls.
44
It will explain browsers, contexts, and pages.
55
It will also cover basic Playwright API calls.
66

@@ -136,14 +136,15 @@ Out of the box, Playwright supports the following types of selectors:
136136
* N-th element
137137
* React
138138
* Vue
139+
* ID attributes
139140

140141
Text and CSS selectors also pierce the Shadow DOM by default!
141142

142143
In general, you should keep selectors as simple as possible.
143144
Try to stick to text, IDs, or CSS selectors.
144145
Use more complicated selectors only as necessary.
145146

146-
This workshop will not cover recommended practices for element selectors deeply.
147+
This tutorial will not cover recommended practices for element selectors deeply.
147148
If you want to learn more about selectors,
148149
read the [Element selectors](https://playwright.dev/python/docs/selectors) page in the Playwright docs,
149150
or take the [Web Element Locator Strategies](https://testautomationu.applitools.com/web-element-locator-strategies/) course
@@ -175,6 +176,11 @@ Append the following line to the test case:
175176
page.fill('#search_form_input_homepage', 'panda')
176177
```
177178

179+
> Since `search_form_input_homepage` is an ID, we could also use Playwright's
180+
> [ID attribute selector](https://playwright.dev/python/docs/selectors#id-data-testid-data-test-id-data-test-selectors):
181+
>
182+
> `page.fill('id=search_form_input_homepage', 'panda')`
183+
178184
Using Selenium WebDriver, we would need to locate the element and then send the interaction to it.
179185
However, in Playwright, these two parts are combined into a single call.
180186
Furthermore, Playwright waits for the target element to be visible and editable before it attempts to enter the text.
@@ -222,4 +228,4 @@ Now, you should see the test actually perform the search!
222228
Navigation, input filling, and clicking are only three of many page interactions you can do with Playwright.
223229
Anything a user can do on a web page, Playwright can do as well.
224230
Check out the Playwright [Page](https://playwright.dev/python/docs/api/class-page) API to see *all* methods and attributes.
225-
We will use more of these calls in the next workshop parts.
231+
We will use more of these calls in the next tutorial parts.

0 commit comments

Comments
 (0)