문제

How do I detect a network timeout of grid requests after starting a Sauce test using the RemoteWebDriver client object? I have a scenario that I want my framework to catch and that is that when connectivity outwards to SauceLabs is working but the connectivity back fails. In other words, this is a network scenario where my Selenium test sends a browser .get() and opens a new browser in SauceLabs with a new URL but then, because of a network issue the subsequent JSON packets fail and the tests appears to hang. I know what the problem is but I just want my unit test framework to report the network issue. Right now the RemoteWebDriver will timeout indefinitely when this condition occurs and that is not acceptable.

I know that to solve this will require an understanding of how the client side timeout works when a RemoteWebDriver client initially tries to send JSON commands to the Grid Hub.

I know I can specify the timeout when starting the Grid but similar options do not appear to be on the client side?

Hub start :- java -jar /tools/grid/selenium-server-standalone-2.35.0.jar 
 -role hub -maxSession 20 -browserTimeout 240 
 -remoteControlPollingIntervalInSeconds 180 -sessionMaxIdleTimeInSeconds 240 
 -newSessionMaxWaitTimeInSeconds 250 -timeout 30
도움이 되었습니까?

해결책

Setting an idle timeout on the Sauce end might help with this: http://saucelabs.com/docs/additional-config#idle-timeout

This desired capability (set by default at 90 seconds) times out if no commands are received from your Selenium script. While it can't detect network issues directly, this could prevent your minutes from being eaten by blocked responses.

You might also benefit from Sauce Connect (https://saucelabs.com/docs/connect), a free, standalone Java utility that enables you to test against firewalled resources. Connect also checks for dropped packets, and will automatically resend them (up to a certain point) in an attempt to re-establish the connection.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top