0

I have a MacBook m2 and I want to test with the Safari web browser. I received this message when I compiled my small test with Intellij idea ce.

Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

My code is:

public class automateBrowsers {
    public static void main(String[] args) {
       
        WebDriverManager.safaridriver().setup();
        WebDriver driver = new SafariDriver(); 

    }
}

I already allow remote automation from Safari develop. So any help, please?

1 Answer 1

0

It seems like you're encountering an issue while trying to start a Selenium session with Safari using WebDriverManager in your Java code. Here are a few troubleshooting steps you can try:

  1. Check Safari version: Ensure that you have the latest version of Safari installed on your MacBook M2. WebDriverManager might not be compatible with older versions of Safari.

  2. Enable Remote Automation in Safari: You mentioned that you've already enabled remote automation in Safari's Develop menu, which is good. Just double-check to make sure it's still enabled.

  3. Check WebDriverManager version: Make sure you're using the latest version of WebDriverManager. You can update it using Maven or Gradle if needed.

  4. Check SafariDriver availability: Ensure that SafariDriver is properly installed and available in your system. Sometimes, you may need to install additional components to enable SafariDriver.

  5. Check Safari Security Settings: Sometimes, Safari's security settings may prevent WebDriver from starting. Make sure you've allowed WebDriver to control Safari in Safari's Preferences > Privacy > Manage Website Data.

  6. Check Safari Extension Settings: If you're using WebDriver with Safari Technology Preview, make sure that the WebDriver extension is enabled in Safari's Preferences > Extensions.

  7. Check Proxy Settings: If you're behind a proxy, ensure that your proxy settings are configured correctly to allow WebDriver to communicate with Safari.

  8. Check Console Logs: Check the Console logs in IntelliJ IDEA for any additional error messages that might provide clues about what's going wrong.

If none of these steps resolve the issue, please provide any error messages or additional details from the IntelliJ IDEA console logs, which can help in diagnosing the problem more accurately.

Not the answer you're looking for? Browse other questions tagged or ask your own question.