@@ -26,6 +26,25 @@ public class VisualClient : IDisposable
26
26
public bool CaptureDom { get ; set ; } = false ;
27
27
private ResiliencePipeline _retryPipeline ;
28
28
29
+ /// <summary>
30
+ /// Creates a new instance of <c>VisualClient</c>
31
+ /// </summary>
32
+ /// <param name="wd">the instance of the WebDriver session</param>
33
+ /// <param name="region">the Sauce Labs region to connect to</param>
34
+ public VisualClient ( WebDriver wd , Region region ) : this ( wd , region , Environment . GetEnvironmentVariable ( "SAUCE_USERNAME" ) , Environment . GetEnvironmentVariable ( "SAUCE_ACCESS_KEY" ) )
35
+ {
36
+ }
37
+
38
+ /// <summary>
39
+ /// Creates a new instance of <c>VisualClient</c>
40
+ /// </summary>
41
+ /// <param name="wd">the instance of the WebDriver session</param>
42
+ /// <param name="region">the Sauce Labs region to connect to</param>
43
+ /// <param name="buildOptions">the options of the build creation</param>
44
+ public VisualClient ( WebDriver wd , Region region , CreateBuildOptions buildOptions ) : this ( wd , region , Environment . GetEnvironmentVariable ( "SAUCE_USERNAME" ) , Environment . GetEnvironmentVariable ( "SAUCE_ACCESS_KEY" ) , buildOptions )
45
+ {
46
+ }
47
+
29
48
/// <summary>
30
49
/// Creates a new instance of <c>VisualClient</c>
31
50
/// </summary>
@@ -47,6 +66,11 @@ public class VisualClient : IDisposable
47
66
/// <param name="buildOptions">the options of the build creation</param>
48
67
public VisualClient ( WebDriver wd , Region region , string username , string accessKey , CreateBuildOptions buildOptions )
49
68
{
69
+ if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( accessKey ) )
70
+ {
71
+ throw new VisualClientException ( "Username or Access Key not set" ) ;
72
+ }
73
+
50
74
_api = new VisualApi < WebDriver > ( wd , region , username , accessKey ) ;
51
75
_sessionId = wd . SessionId . ToString ( ) ;
52
76
_jobId = wd . Capabilities . HasCapability ( "jobUuid" ) ? wd . Capabilities . GetCapability ( "jobUuid" ) . ToString ( ) : _sessionId ;
0 commit comments