Exception in initiating a browser session in path:, The driver server has unexpectedly died!
Exception in initiating a browser session in path:, Could not create a session: The session timed out while connecting to a Safari instance.
Exception in initiating a browser session in path:, Could not create a session: The Safari instance is already paired with another WebDriver session.
While Testsigma creates a browser session, it invokes the webbrowserd (Web browser daemon process) for communicating with Safari browser.
Rarely, the webbrowserd process or safari web browser process might become unresponsive due to conflict with other processes as we discussed below in section 'Cause of Issue'. This may lead to Browser Initiation error as given above.
In all the above cases, we need to stop the Execution, kill the safari and webdriver processes manually to fix the error before starting the execution again.
We can do the same using the below methods.
Using Activity Monitor
1.Navigate to Activity Monitor(Applications->Utilities->Activity Monitor) or search in Spotlight search.
2. Search for the task name and press keys (Command+A) to select all of them.
Note: There are no webdriverd processes running at the time of search
3. Then click 'X' button and quit all corresponding tasks.
1. Open the Terminal App
2. Type the following command and press Enter
launchctl list | grep webdriverd
This command is used to show the daemons or agents running on your Mac. The grep command filters the list to processes whose name contains the "webdriverd" string. We will get the following output:
53970 0 com.apple.webdriverd
Note: The PID might vary for each instance.
3. Note down the first integer part which is the process ID (PID); in this case, '53970'.
4. Type the following command and replace the <PID> with the output of the previous command.
sudo kill <PID>
This process will kill the unresponsive Webdriver daemon. Now we can restart the execution without any issues.
Cause of Issue
The processes running on your Mac or Windows PC may sometimes become unresponsive due to Operating System(OS) issues or conflict with other processes. Usually, the Operating System kills the unresponsive process and restarts the same automatically without user intervention.
However, there might be instances when the OS fails to kill the process when it wrongly identifies the process as being in use. This process stays in the memory and unexpected issues might occur when we are trying to run the process again.
In such cases, we need to kill the processes manually and restart them. That is what we are doing in the above article.