• I would like to be able to use Selenium 2 with Jenkins.

  • I am new to both so please excuse any of my ignorance.

  • I noticed the following plugin for jenkins HERE, and installed it.

  • I have a base class as follows:

    public class BaseTestClass {
    
    protected Properties myprops;
    protected String baseurl;
    protected WebDriver driver;
    protected boolean acceptNextAlert = true;
    protected StringBuffer verificationErrors = new StringBuffer();
    
    public BaseTestClass()
    {
        try
        {
            myprops = TestUtil.readProps("src/MyProps.properties");
            baseurl = myprops.getProperty("baseurl");
    
            driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.fireFox());
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }       
    }
    
    @Before
    public void setUp() throws Exception {
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
    
    @After
    public void tearDown() throws Exception {
        driver.quit();
        String verificationErrorString = verificationErrors.toString();
        if (!"".equals(verificationErrorString)) {
            fail(verificationErrorString);
        }
    }
    
    protected boolean isElementPresent(By by) {
        try {
          driver.findElement(by);
          return true;
        } catch (NoSuchElementException e) {
          return false;
        }
      }
    
      protected String closeAlertAndGetItsText() {
        try {
          Alert alert = driver.switchTo().alert();
          if (acceptNextAlert) {
            alert.accept();
          } else {
            alert.dismiss();
          }
          return alert.getText();
        } finally {
          acceptNextAlert = true;
        }
      }
    

I have the following configuration on the Selenium Plugin for Jenkins :

enter image description here

Edit
Report