How can I press the alert ok button programmatically?

后端 未结 8 1022
有刺的猬
有刺的猬 2020-12-21 11:15

How can I press the OK button in a JS alert programmatically?

What I want to do: every time after the alert is created, the OK button is pressed.

This is for

相关标签:
8条回答
  • 2020-12-21 11:48
    $this->chooseOkOnNextConfirmation();
    $this->click('locator');
    $this->getConfirmation();
    

    The above process worked for me using Selenium RC with PHPUnit

    0 讨论(0)
  • 2020-12-21 11:49

    You can't. Unless you use something that can control the browser (e.g. selenium).

    If you do use selenium, have a look at Click in OK button inside an Alert (Selenium IDE)

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