[BUG] "--no-startup-window" DEFAULT Option might cause hang on Browser.close()
See original GitHub issueContext:
- Playwright Version: any version
- Operating System: Windows 10 Enterprise (64-bit)
- Browser: Chrome - 91.0.4472.114 (Official Build) (64-bit)
- Extra: A lot of network restriction - Not allow chrome update.
Code Snippet
import com.microsoft.playwright.*;
import com.microsoft.playwright.BrowserType.LaunchOptions;
import com.microsoft.playwright.options.LoadState;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static com.microsoft.playwright.options.WaitUntilState.DOMCONTENTLOADED;
public class Test {
static Playwright playWright = null;
static Browser browser = null;
static BrowserContext context = null;
static Page page = null;
// DEBUG=pw:api
// DEBUG=pw:browser
// DEBUG=pw:channel
// DEBUG=pw:*
public static void main(String args[]) throws Exception {
try {
playWright = Playwright.create();
BrowserType browserType = playWright.chromium();
LaunchOptions options = new LaunchOptions();
options.setExecutablePath(Paths.get("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"));
options.setHeadless(false);
options.setChromiumSandbox(true);
// List<String> ignoreDefaultArgs = new ArrayList<>();
// ignoreDefaultArgs.add("--no-startup-window"); // Caused Issue - Must be Removed from default Option
// options.setIgnoreDefaultArgs(ignoreDefaultArgs);
browser = browserType.launch(options);
context = browser.newContext(
new Browser.NewContextOptions()
.setViewportSize(800, 600)
);
page = context.newPage();
String url = "http://www.ephung.com/";
page.navigate(url, new Page.NavigateOptions().setWaitUntil(DOMCONTENTLOADED));
System.out.println("DONE.");
} catch (Exception ex) {
ex.printStackTrace();
} finally {
// tear down
if (page != null) {
page.close();
page = null;
}
System.out.println("START close Browser " + new Date());
if (browser != null) {
browser.close();
browser = null;
}
System.out.println("END close Browser " + new Date());
if (context != null) {
context.close();
context = null;
}
if (playWright != null) {
playWright.close();
playWright = null;
}
}
}
}
NOTE: Look for the timestamp in log of this code output
System.out.println("START close Browser " + new Date());
if (browser != null) {
browser.close();
browser = null;
}
System.out.println("END close Browser " + new Date());
Describe the bug
One Browser Open look correct - When application Browser.close() Error occur with timeout - kick off kill playwright process
When Set to Ignore Argument “–no-startup-windows” - there are 2 browsers open - but Browser.close() closed immediately
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
IE opens flashes and closes immediately when starting it
You may notice that Internet Explorer opens, flashes, and immediately closes when you start Internet Explorer. Cause. The most common causes of ...
Read more >Restoring 600 tabs at once can make browser completely ...
But if the servers close the channel (because they think the browser has died) then chrome will hang on the channel forever (burning...
Read more >Common Microsoft Edge Problems, and How to Fix Them
The first obvious solution is to make sure you're running the latest version of Windows 10 or Windows 11 and Microsoft Edge. Microsoft...
Read more >"Firefox is already running but is not responding" error
Note: If this is a recurring problem, see Firefox hangs when you quit it for ... an error message will appear with the...
Read more >Chrome is not Working on Windows 11: 8 Rigorous Methods ...
To fix Windows 11 Chrome not working, try starting that browser in its safe mode and disabling antivirus tools as outlined in this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When open the browser it’s default homepage to company 365 sharepoint (by default). The auto-login is probably set in the IE Security Zone configuration for autologin with ADFS which explain how when open the browser auto login SharePoint (after redirect to login site and come back to company sharepoint…etc). NOTE: I do not have permission to view IE Setting (all are disabled). I will take a look at the code from the links you’ve provided.
Closing as part of the triage process since it seemed stale or did not get enough upvotes in the past. Please create a new issue with a detailed reproducible or feature request if you still face issues.