playwright-java: [BUG] java.lang.RuntimeException: Failed to create driver

Context:

  • Playwright Version: 1.17.2
  • Operating System: [e.g. Windows]
  • Browser: [Chrome]
  • Extra: standalone Selenium Grid 4 is set up in a windows remote machine. Getting below error while running testcase through standalone selenium grid 4(created in a remote windows machine) playwright version used 1.17.2
[INFO] Running org.example.AppTest
java.lang.RuntimeException: Failed to create driver
	at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:54)
	at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:39)
	at com.microsoft.playwright.Playwright.create(Playwright.java:92)

code snippet

public void shouldAnswerWithTrue()
{
    List<String> list=new ArrayList<String>();
    list.add("--start-maximized");
    Map<String, String> env = new HashMap<>();
    env.put("SELENIUM_REMOTE_URL", "http://testing.net.int:4444/");
    try(Playwright playwright = Playwright.create(new Playwright.CreateOptions().setEnv(env))){
        Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setHeadless(false).setSlowMo(100).setArgs(list));
        BrowserContext browserContext = browser.newContext();
        Page page = browserContext.newPage();
    }
    catch (Exception e) {
            e.printStackTrace();
        }
}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (8 by maintainers)

Most upvoted comments

@anthonyalayo public static void browserSet(String browsers) { Map<String, String> env = new HashMap<>(); env.put(“PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD”, “1”); Playwright.CreateOptions createOptions = new Playwright.CreateOptions(); createOptions.setEnv(env); browser = Playwright.create(createOptions).chromium().launch( new BrowserType.LaunchOptions() .setExecutablePath(Paths.get(“Path/to/browser.exe”))) .setHeadless(false) .setChromiumSandbox(true)); context = browser.newContext( new Browser.NewContextOptions() .setViewportSize(1800, 1080) ); }