Wait for a user input during Selenium process for two-steps verification code (C#)

I am currently automating (Visual Studio C#) the invoice submission process through Tungsten portal, as a desktop application for any user who would have the program, using Selenium and I have to get through the two-steps verification code. One way would be to get the code by script directly from the email received and the other I thought of would be to start the Selenium process right after the user logins manually or to interrupt the process to wait for the user to enter the verification code manually.

Is there a way to achieve the second possibility (manual login before starting Selenium process from there or process interruption for manual input of the verification code)?

Thank you all for your answers!

1 answer

  • answered 2021-03-08 20:22 PDHide

    Close all chrome instance and then Start chrome with debug port:

    <path>\chrome.exe" --remote-debugging-port=1559
    

    Verify the debug port is set by going to localhost:1559

    And in selenium use :

    ChromeOptions options = new ChromeOptions();
    options.DebuggerAddress = "127.0.0.1:9222";
    Driver = new ChromeDriver(options);