George
George

Reputation: 51

"Can't find profile directory" error while running some tests in a Firefox browser window by Selenium

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?

Gecko driver: v0.25.0-win32;

Selenium: 3.141.59;

Framework: JUnit;

Firefox: 69.0

I tried both Implicit and Explicit waits, but it doesn't help.

My general TestBase java class:

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(() -> { driver.quit(); driver=null;}));
  }

And testsbased class:

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"));
  }
}

My output is error:

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

Upvotes: 5

Views: 12829

Answers (1)

Richard
Richard

Reputation: 19

Selenium is not supported Firefox Quantum [v69]

Please downgrade the firefox to min v57.

https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html

Upvotes: 0

Related Questions