Python mit Dramatikern
LOCALHOST: 8000
Chrome-Browser im nicht headlosen Modus < /p>
Problem:
Ich versuche, eine CSV -Datei mit Dramatikern mit Python hochzuladen, aber ich erhalte die folgenden Fehler in der Konsole: < /p>
Die Ressource nicht laden: Der Server antwortete mit einem Status von 404 (nicht gefunden) für favicon.ico
post http: // localhost: 8000/upload - net :: err_h2_or_quic_required
ungekorden (in Versprechen) TypeRror: Versäumnis, vor HandlesuBmit < BR />
Bildbeschreibung hier eingeben Bild mit dem isShu < /p>
Code: < /strong> Hier ist mein Dramatiker -Testcode: < /p>
Here is the full code:
https://github.com/BoazYashar/Shopic
< /code>
def test_response_format_and_values():
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)
page = browser.new_page()
upload_page = UploadPage(page)
# Upload a valid file and click on upload
response = upload_page.upload_file("valid_products.csv")
< /code>
And here's the relevant page object code:
class UploadPage(BasePage):
def upload_file(self, file_name: str) -> str:
self.navigate("http://localhost:8000")
file_path = str(CSV_FILE_PATH / file_name)
self.page.set_input_files(self.file_input_selector, file_path)
self.page.wait_for_selector(self.upload_button_selector)
self.page.click(self.upload_button_selector)
self.page.wait_for_selector(self.message_selector)
results = self.page.text_content(self.message_selector)
return results
< /code>
What I've Tried:
The file upload interface appears to be working (I can select the file), but the actual POST request to /upload is failing with a network error.
Question:
Why am I getting the ERR_H2_OR_QUIC_REQUIRED error and how can I fix it? The error suggests there might be an issue with the HTTP/2 protocol, but I'm not sure how to properly configure this for local development.
What I've Tried:
- I tried uploading the file in several different ways, but none worked
- I attempted various HTTP/2 solutions suggested by ChatGPT
The CSV file should be uploaded successfully to the local server and return a JSON response.
Actual Behavior:
The request fails with ERR_H2_OR_QUIC_REQUIRED and a TypeError: Failed to fetch error.