Interacting with pop-up boxes using selenium in python

前端 未结 2 2040
眼角桃花
眼角桃花 2021-02-06 18:12

I\'m trying to use the Selenium module in python to generate a text list from one website, save it in a directory, and browse to that text list on another site to submit it.

2条回答
  •  情话喂你
    2021-02-06 18:28

    Extremely simple implementation using AutoIT.

    Below scripts and steps can hely you to click on 'Save>OK' on this window's pop-UP

    Step 1: Download AutoIT package/tool here AutoIt You may select ZIP format (extract it)

    Step 2: Open any text editor (say notepad) and copy below code and save with extension .au3
    (e.g file.au3)

    WinWait("[TITLE:Opening ; CLASS:MozillaDialogClass]","", 10)
    If WinExists("[TITLE:Opening ; CLASS:MozillaDialogClass]") Then
    WinActivate("[TITLE:Opening ; CLASS:MozillaDialogClass]")
    Send("{DOWN}")
    Sleep(20)
    Send("{TAB}")
    Sleep(20)
    Send("{TAB}")
    Sleep(20)
    Send("{ENTER}")
    EndIf
    

    Step 3: From extracted zip (Step 1) look for folder named: Aut2Exe and open it

    Step 4: Click Aut2exe_x64.exe if your OS is 64 bit otherwise click Aut2exe.exe

    Step 5: Browse/Locate file created in Step2. (file saved as extension .a3) AND Choose Destination (.exe/.a3x) and select .exe option (say file.exe) AND then Click convert

    Step 6: include this file.exe in your project folder and use it as per your requirement using below code (as it is in Eclipse):

    driver.dwonload().click(); // it can be something else as per your flow
    Runtime.getRuntime().exec("C:/*path_to_your_EXE_file(selected in step 6))*/file.exe");
    

提交回复
热议问题