Check out example codes for "selenium firefox to foreground -python java". It will help you in understanding the concepts better.

Code Example 1

((JavascriptExecutor) webDriver).executeScript("window.focus();");

Learn ReactJs, React Native from akashmittal.com