Selenium: How to prompt user input and use the input value?

后端 未结 1 624
感动是毒
感动是毒 2020-12-22 11:20

I have a situation (during a selenium test), in which the user will receive a security code. The user must then input the security code before being allowed to continue.

1条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-22 12:04

    It seems you have to accept and close the prompt first, before being able to store and use the value

        alert.accept();
        code = (String) js.executeScript("return window.promptResponse");
    

    0 讨论(0)
提交回复
热议问题