File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
versioned_docs/version-2x/Guides Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ Native locators allow you to leverage the full power of your testing framework's
214
214
// Using the argument from feature file
215
215
DynamicElement = locator .native (({ page, argument }) =>
216
216
page .getByRole (' button' , { name: argument }));
217
+
218
+ // Element in iframe
219
+ ElementInIframe = locator .native (({ page }) => page .frameLocator (' iframe#yourIframe' ).locator (' #element' ));
217
220
}
218
221
```
219
222
</TabItem >
@@ -224,7 +227,7 @@ Native locators allow you to leverage the full power of your testing framework's
224
227
225
228
class App {
226
229
// Using Playwright's getByRole
227
- SubmitButton = locator .native (({ page }: { page: Page }) =>
230
+ SubmitButton = locator .native (({ page }: { page: Page }) =>
228
231
page .getByRole (' button' , { name: ' Submit' }));
229
232
230
233
// Using Playwright's getByText with regex
@@ -242,6 +245,9 @@ Native locators allow you to leverage the full power of your testing framework's
242
245
// Using the argument from feature file
243
246
DynamicElement = locator .native (({ page , argument }: { page: Page , argument: string }) =>
244
247
page .getByRole (' button' , { name: argument }));
248
+
249
+ // Element in iframe
250
+ ElementInIframe = locator .native (({ page }: { page: Page }) => page .frameLocator (' iframe#yourIframe' ).locator (' #element' ));
245
251
}
246
252
```
247
253
</TabItem >
You can’t perform that action at this time.
0 commit comments