title: "Can't find profile directory" error while running some tests in a Firefox browser window by Selenium
body: <p>Please, advise me. I'm just learning Selenium WebDriver tools and trying to run some tests in a window of Firefox, but the second test is always failed. How can I avoid this?</p>
  
  <p>Gecko driver: v0.25.0-win32;</p>
  
  <p>Selenium: 3.141.59;</p>
  
  <p>Framework: JUnit;</p>
  
  <p>Firefox: 69.0</p>
  
  <p>I tried both Implicit and Explicit waits, but it doesn't help.</p>
  
  <p>My general TestBase java class:</p>
  
  <pre><code>public class TestBase {
  
    public static WebDriver driver;
    public static WebDriverWait wait;
  
    @Before
    public void start() {
      if (driver !=null){
        return;
      }
  
      DesiredCapabilities caps = new DesiredCapabilities();
      //caps.setCapability(FirefoxDriver.MARIONETTE, false);
      driver = new FirefoxDriver(caps);
      System.out.println(((HasCapabilities) driver).getCapabilities());
      wait = new WebDriverWait(driver, 10);
  
  
      Runtime.getRuntime().addShutdownHook(
              new Thread(() -&gt; { driver.quit(); driver=null;}));
    }
  </code></pre>
  
  <p>And testsbased class:</p>
  
  <pre><code>public class MyThirdTest extends TestBase {
  
    @Test
    public void mySecondTest() {
      driver.navigate().to("https://google.com");
      driver.findElement(By.name("q")).sendKeys("webdriver");
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("btnK"))).click();
      wait.until(titleIs("webdriver - Поиск в Google"));
    }
  
    @Test
    public void myThirdTest() {
      driver.navigate().to("https://google.com");
      driver.findElement(By.name("q")).sendKeys("webdriver");
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("btnK"))).click();
      wait.until(titleIs("webdriver - Поиск в Google"));
    }
  }
  </code></pre>
  
  <p>My output is error:</p>
  
  <blockquote>
    <p>JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error:
    Can't find profile directory. 1568573084487   Marionette  INFO    Listening
    on port 58557 Sep 15, 2019 9:44:44 PM
    org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
    Detected dialect: W3C</p>
  </blockquote>