Posts

Showing posts from November, 2012

Selenium 2 Java Quick Setup

I had a seemingly random issue with a website where it would fail one out of x times. Since I haven't used Selenium 2 yet I thought I would run a Selenium test. To get started in Selenium 2 and Java the quickest way is to use Selenium IDE and generate some tests. Then use the File -> Export Test Case As -> Java / JUnit 4 WebDriver Backend. After the test is created then just drop it into Netbeans or Eclipse. The first stumbling block I ran into was that I needed Both Selenium Client and Selenium Server Jars added. Without the Selenium Server Jar, I saw an unhelpful error that stated: "com/google/common/base/Function". After adding those 2 Jars, if you don't use the Eclipse or Netbeans test runners, make sure to add the JUnit Jar. Then you can run your test. Here is a shell that does nothing but run a test that was outputted from Selenium IDE. package webdriversample; import com.thoughtworks.selenium.Selenium; import org.junit.After; import org.junit.Asser