c# - Timeout on Alert.Accept method - Stack Overflow

admin2025-04-29  1

The website that I am testing has a logout button. When I click the logout button there is an Alert popup When I Accept the popup the Accept hangs for a long time I think the Accept times out

How can I change the alert.Accept timeout period?

I would like the Alert.Accept to return to my test in a short time

The website that I am testing has a logout button. When I click the logout button there is an Alert popup When I Accept the popup the Accept hangs for a long time I think the Accept times out

How can I change the alert.Accept timeout period?

I would like the Alert.Accept to return to my test in a short time

Share Improve this question asked Jan 7 at 2:34 user3801466user3801466 12 bronze badges 10
  • OpenQA.Selenium.WebDriverException HResult=0x80131500 Message=The HTTP request to the remote WebDriver server for URL localhost:51337/session/4e50d5d4-3a56-4300-847a-6eb659bce109/… timed out after 60 seconds. Inner Exception 1: TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing. – user3801466 Commented Jan 7 at 2:48
  • 1 Please share a minimal reproducible example. – mjwills Commented Jan 7 at 3:50
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Jan 7 at 4:06
  • Does the site/page have the same behavior when you perform these steps manually? If so, there's not much you can do about it. – JeffC Commented Jan 7 at 6:56
  • chances are it's throwing an unexpected prompt error. Hard to tell without seeing code. You can set the unexpected alert behavior to not throw. By default I think it's "accept and notify". The "notify" part is the thrown exception. If you want it to always accept and not throw, set unexpected prompt behavior in driver options. – browsermator Commented Jan 7 at 17:29
 |  Show 5 more comments

1 Answer 1

Reset to default 0

My problem is caused by the behaviour of the web site that I am testing.

The web site that I am testing sometime raises zero, one, two or more alerts so I have to wait until no more alerts occur. The time between alerts may be zero, one or more seconds so I have to wait the worst case seconds just in case one or more of the delayed alerts occur. So my problem is all the fault of the web site that I am testing.

转载请注明原文地址:http://anycun.com/QandA/1745934474a91330.html