|
33 | 33 | import com.google.common.collect.ArrayListMultimap; |
34 | 34 | import com.google.common.collect.Multimap; |
35 | 35 | import org.apache.commons.lang3.ArrayUtils; |
| 36 | +import org.apache.logging.log4j.LogManager; |
| 37 | +import org.apache.logging.log4j.Logger; |
36 | 38 | import org.openqa.selenium.logging.LogEntries; |
37 | 39 | import org.openqa.selenium.logging.LogEntry; |
38 | 40 | import org.testar.environment.Environment; |
|
48 | 50 | import org.testar.monkey.alayer.webdriver.Constants; |
49 | 51 | import org.testar.monkey.alayer.webdriver.enums.WdRoles; |
50 | 52 | import org.testar.monkey.alayer.webdriver.enums.WdTags; |
| 53 | +import org.testar.monkey.alayer.windows.WinApiException; |
51 | 54 | import org.testar.monkey.alayer.windows.WinProcess; |
52 | 55 | import org.testar.monkey.alayer.windows.Windows; |
53 | 56 | import org.testar.plugin.NativeLinker; |
|
65 | 68 | import static org.testar.monkey.alayer.Tags.Enabled; |
66 | 69 |
|
67 | 70 | public class WebdriverProtocol extends GenericUtilsProtocol { |
| 71 | + |
| 72 | + protected static final Logger logger = LogManager.getLogger(); |
| 73 | + |
68 | 74 | //Attributes for adding slide actions |
69 | 75 | protected static double SCROLL_ARROW_SIZE = 36; // sliding arrows |
70 | 76 | protected static double SCROLL_THICK = 16; //scroll thickness |
@@ -268,11 +274,17 @@ protected State getState(SUT system) throws StateBuildException { |
268 | 274 | && system.get(Tags.PID, (long)-1) != (long)-1 |
269 | 275 | && WinProcess.procName(system.get(Tags.PID)).contains("chrome") |
270 | 276 | && !WinProcess.isForeground(system.get(Tags.PID))){ |
271 | | - |
272 | | - WinProcess.toForeground(system.get(Tags.PID), 0.3, 100); |
273 | | - LogSerialiser.log("Trying to set Chrome Browser to Foreground... " |
274 | | - + WinProcess.procName(system.get(Tags.PID)) + "\n"); |
275 | | - |
| 277 | + |
| 278 | + String msg = "Trying to set the browser to Foreground... " + system.get(Tags.PID, -1L); |
| 279 | + logger.log(org.apache.logging.log4j.Level.INFO, msg); |
| 280 | + |
| 281 | + try { |
| 282 | + WinProcess.toForeground(system.get(Tags.PID), 0.3, 100); |
| 283 | + } catch (WinApiException wae) { |
| 284 | + logger.log(org.apache.logging.log4j.Level.WARN, wae); |
| 285 | + Verdict verdict = new Verdict(Verdict.Severity.NOT_RESPONDING, "Unable to bring the browser to foreground!"); |
| 286 | + state.set(Tags.OracleVerdict, verdict); |
| 287 | + } |
276 | 288 | } |
277 | 289 |
|
278 | 290 | return state; |
|
0 commit comments