V
V
Vetal Matitskiy2014-12-18 16:34:44
Java
Vetal Matitskiy, 2014-12-18 16:34:44

Selenium crashes when trying to start firefox. What could be the problem?

in the configured Eclipse environment, the test exported from Selenium IDE crashes with an error on the line
"driver = new FirefoxDriver();"
all the necessary heats are connected
, what could be the reason for this?
complete code

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class Ex5 {
  private WebDriver driver;
  private String baseUrl;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://ya.ru/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testEx5() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.id("text")).clear();
    driver.findElement(By.id("text")).sendKeys("selenium");
    driver.findElement(By.xpath("//button[@type='submit']")).click();
  }

  @After
  public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
      fail(verificationErrorString);
    }
  }

  private boolean isElementPresent(By by) {
    try {
      driver.findElement(by);
      return true;
    } catch (NoSuchElementException e) {
      return false;
    }
  }

  private boolean isAlertPresent() {
    try {
      driver.switchTo().alert();
      return true;
    } catch (NoAlertPresentException e) {
      return false;
    }
  }

  private String closeAlertAndGetItsText() {
    try {
      Alert alert = driver.switchTo().alert();
      String alertText = alert.getText();
      if (acceptNextAlert) {
        alert.accept();
      } else {
        alert.dismiss();
      }
      return alertText;
    } finally {
      acceptNextAlert = true;
    }
  }
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikolai Pavlov, 2014-12-18
@gurinderu

Well falls for certain with Exception.
Show it.

V
Vetal Matitskiy, 2014-12-19
@vetalmatitskiy

thanks for the support. dealt with the issue. it turns out that not all jar-ki connected

A
Anton, 2017-04-29
@dmitrylogvinov

libArray = {
  "Лес": 1234,
  "Дача": 872343,
  "Хлеб": 8734,
  "Аккуратность": 4343
}
findIt = "Лес" #Значение, которое ищется
if findIt in libArray:
  print(libArray[findIt])

R
riot26, 2017-04-29
@riot26

foo = {
    'Лес' : 2134,
    'Дача' : 872343,
    'Хлеб' : 8734,
    'Аккуратность' : 4343
}
print(foo['Хлеб'])    #вывод: 8734
foo['Котики'] = 12345
print(foo['Котики'])  #вывод: 12345

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question