@@ -28,18 +28,26 @@ def test_download_pdf_from_context_menu(
2828):
2929 """
3030 C1756790: Verify that Telemetry is Recorded when Saving a PDF from the Context menu
31+
32+ Notes:
33+ - Firefox is launched with a new profile (also a test case precondition) that has default download settings.
34+ - This means the OS-level "Save File" dialog will appear for every download.
35+ - Selenium cannot interact with this native dialog directly, so the test
36+ must rely on fixed waits to give the OS time to render the dialog and to
37+ finish writing the file.
3138 """
3239
3340 from pynput .keyboard import Controller
3441
42+ # Initialize objects
3543 pdf = GenericPdf (driver , pdf_url = fillable_pdf_url )
36- pdf .open ()
3744 keyboard = Controller ()
38- body = pdf . get_element ( "pdf-body" )
45+ context_menu = ContextMenu ( driver )
3946
40- # Right-click on the body of the file and select Save page as
47+ # Open the PDF file, right-click on the body of the file and select Save page as
48+ pdf .open ()
49+ body = pdf .get_element ("pdf-body" )
4150 pdf .context_click (body )
42- context_menu = ContextMenu (driver )
4351 context_menu .click_and_hide_menu ("context-menu-save-page-as" )
4452
4553 # Allow time for the save dialog to appear and handle prompt
@@ -51,7 +59,8 @@ def test_download_pdf_from_context_menu(
5159 sleep (3 )
5260
5361 # Open about:telemetry and go to events tab
54- about_telemetry = AboutTelemetry (driver ).open ()
62+ about_telemetry = AboutTelemetry (driver )
63+ about_telemetry .open ()
5564 about_telemetry .get_element ("events-tab" ).click ()
5665
5766 # Verify that Telemetry is recorded
0 commit comments