Reputation: 31
Browser chrome will be opened by selenium and executing some operations, but its seems to be not bring to front even it focused. How can i make this chrome window bring to front?
Upvotes: 1
Views: 2828
Reputation: 193218
Here is what you need to do:
Before you switch to any other window opened store the parent window handle in a String: String parent_window = driver.getWindowHandle();
Switch to any other window & perform your actions.
Finally, switch back to the parent window through the parent window handle stored in a String: driver.switchTo().window(parent_window);
Perform the rest of your operations and call driver.quit();
Let me know if this Answers your question.
Upvotes: 2
Reputation: 413
Set this
System.setProperty("webdriver.chrome.driver", "path of the exe file\\chromedriver.exe");
and then add this line
WebDriver driver=new ChromeDriver();
Upvotes: 0