@@ -9,7 +9,7 @@ namespace Selenium {
99 /// </summary>
1010 /// <example>
1111 /// Sets the implicit timout to 1 second
12- /// <code lang="vbs">
12+ /// <code lang="vb">
1313 /// driver.Timeouts.ImplicitWait = 1000
1414 /// </code>
1515 /// </example>
@@ -19,10 +19,25 @@ namespace Selenium {
1919 [ ComVisible ( true ) , ClassInterface ( ClassInterfaceType . None ) ]
2020 public class Timeouts : ComInterfaces . _Timeouts {
2121
22- internal int timeout_implicitwait = 3000 ;
23- internal int timeout_pageload = - 1 ;
24- internal int timeout_script = - 1 ;
25- internal int timeout_server = 60000 ;
22+ private static void SendTimeoutScript ( RemoteSession session , int timeout ) {
23+ session . Send ( RequestMethod . POST , "/timeouts" , "type" , "script" , "ms" , timeout ) ;
24+ }
25+
26+ private static void SendTimeoutPageLoad ( RemoteSession session , int timeout ) {
27+ session . Send ( RequestMethod . POST , "/timeouts" , "type" , "page load" , "ms" , timeout ) ;
28+ }
29+
30+ private static void SendTimeoutImplicit ( RemoteSession session , int timeout ) {
31+ session . Send ( RequestMethod . POST , "/timeouts" , "type" , "implicit" , "ms" , timeout ) ;
32+ }
33+
34+
35+ private RemoteSession _session ;
36+
37+ internal int timeout_server = 90000 ; // 90 seconds
38+ internal int timeout_pageload = 60000 ; // 60 seconds
39+ internal int timeout_implicitwait = 3000 ; // 3 seconds
40+ internal int timeout_script = 15000 ; // 15 seconds
2641
2742 /// <summary>
2843 /// Amount of time that Selenium will wait for waiting commands to complete
@@ -32,6 +47,7 @@ public int ImplicitWait {
3247 return timeout_implicitwait ;
3348 }
3449 set {
50+ if ( value == timeout_implicitwait ) return ;
3551 timeout_implicitwait = value ;
3652 }
3753 }
@@ -44,18 +60,24 @@ public int PageLoad {
4460 return timeout_pageload ;
4561 }
4662 set {
63+ if ( value == timeout_pageload ) return ;
64+ if ( _session != null )
65+ SendTimeoutPageLoad ( _session , value ) ;
4766 timeout_pageload = value ;
4867 }
4968 }
5069
5170 /// <summary>
52- /// Amount of time the driver should wait while executing a script before throwing an exception .
71+ /// Amount of time the driver should wait while executing an asynchronous script before throwing an error .
5372 /// </summary>
5473 public int Script {
5574 get {
5675 return timeout_script ;
5776 }
5877 set {
78+ if ( value == timeout_script ) return ;
79+ if ( _session != null )
80+ SendTimeoutScript ( _session , value ) ;
5981 timeout_script = value ;
6082 }
6183 }
@@ -68,10 +90,17 @@ public int Server {
6890 return timeout_server ;
6991 }
7092 set {
93+ if ( value == timeout_server ) return ;
7194 timeout_server = value ;
7295 }
7396 }
7497
98+ internal void SetSession ( RemoteSession session ) {
99+ _session = session ;
100+ SendTimeoutPageLoad ( _session , timeout_pageload ) ;
101+ SendTimeoutScript ( _session , timeout_pageload ) ;
102+ }
103+
75104 }
76105
77106}
0 commit comments