selenium webdrive and checking alert messages

后端 未结 1 840
别跟我提以往
别跟我提以往 2021-01-14 09:39

I am parsing my page with selenium and i am handling javascript alert messages with selenium to. But this is very slow to check every page if it has JS alert popup message b

相关标签:
1条回答
  • 2021-01-14 10:11

    A future enhancement to webdriver will be to throw an exception on any command if an alert is present.

    The current implementation of SwitchTo().Alert() causes a small sleep delay because it has to wait for the browser to propagate the events for the alert window to appear (IIRC it's 300ms).

    For now what you have is your best bet for when you don't know for sure if an alert will appear on the page. In the future you should be able to catch a different exception for regular commands that don't have the delay built in.

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