@@ -113,8 +113,36 @@ public bool IsInstalled()
113
113
114
114
public void Activate ( )
115
115
{
116
- // TODO thorw exception if needed
117
- Process . Start ( "ActivateStoreApp" , this . AppUserModelId ) ;
116
+ logger . Info (
117
+ "Activate the store app; current working directory = [{0}], " +
118
+ "AppUserModelID = [{1}]." ,
119
+ Environment . CurrentDirectory , this . AppUserModelId ) ;
120
+
121
+ var info = new ProcessStartInfo (
122
+ Path . Combine ( Environment . CurrentDirectory , "ActivateStoreApp.exe" ) ,
123
+ this . AppUserModelId ) ;
124
+ info . UseShellExecute = false ;
125
+ info . RedirectStandardOutput = true ;
126
+ info . RedirectStandardError = true ;
127
+
128
+ var process = Process . Start ( info ) ;
129
+ logger . Debug ( "PID of ActivateStoreApp.exe = {0}." , process . Id ) ;
130
+ process . WaitForExit ( ) ;
131
+
132
+ if ( process . ExitCode == 0 )
133
+ {
134
+ logger . Debug ( "STDOUT = [{0}]." , process . StandardOutput . ReadToEnd ( ) ) ;
135
+ }
136
+ else
137
+ {
138
+ string msg = string . Format (
139
+ "Error occurred while activating the store app; " +
140
+ "code = {0}, STDOUT = [{1}], STDERR = [{2}]." ,
141
+ process . ExitCode ,
142
+ process . StandardOutput . ReadToEnd ( ) ,
143
+ process . StandardError . ReadToEnd ( ) ) ;
144
+ throw new WinAppDriverException ( msg ) ;
145
+ }
118
146
}
119
147
120
148
public void Terminate ( )
0 commit comments