@@ -13,15 +13,24 @@ class Environment {
1313 private final static String SDK_VERSION = "2.1.2" ;
1414 private final static String SDK_NAME = "percy-java-selenium" ;
1515
16+ private String clientInfoOverride ;
17+ private String environmentInfoOverride ;
18+
1619 Environment (WebDriver driver ) {
1720 this .driver = driver ;
1821 }
1922
2023 public String getClientInfo () {
24+ if (clientInfoOverride != null ) {
25+ return clientInfoOverride ;
26+ }
2127 return SDK_NAME + "/" + SDK_VERSION ;
2228 }
2329
2430 public String getEnvironmentInfo () {
31+ if (environmentInfoOverride != null ) {
32+ return environmentInfoOverride ;
33+ }
2534 // If this is a wrapped driver, get the actual driver that this one wraps.
2635 WebDriver innerDriver = this .driver instanceof WrapsDriver ?
2736 ((WrapsDriver ) this .driver ).getWrappedDriver ()
@@ -33,4 +42,16 @@ public String getEnvironmentInfo() {
3342 // We don't know this type of driver. Report its classname as environment info.
3443 return String .format ("selenium-java; %s" , driverName );
3544 }
45+
46+ void setClientInfo (String clientInfo ) {
47+ this .clientInfoOverride = clientInfo ;
48+ }
49+
50+ void setEnvironmentInfo (String environmentInfo ) {
51+ this .environmentInfoOverride = environmentInfo ;
52+ }
53+
54+ public static String getSdkVersion () {
55+ return SDK_VERSION ;
56+ }
3657}
0 commit comments