Code: Select all
from playwright.sync_api import sync_playwright
Auf meiner Seite habe ich mehrere Elemente wie folgt:
Code: Select all
JSON
Text
Hex
< /code>
Ich möchte alle auf die Option "RAW" einstellen. < /p>
Was ich bisher versucht habe: < /p>
### Attempt 1
page.locator("select").all() # AttributeError: 'Locator' object has no attribute 'all'
### Attempt 2
page.query_selector_all("select") # AttributeError: 'Page' object has no attribute 'query_selector_all'
### Attempt 3
for select in page.locator("select"):
select.select_option("raw") # TypeError: 'Locator' object is not iterable
### Attempt 4
selects = page.locator("select")
for s in selects:
s.select_option("raw") # same error, not iterable
Schleifen>