Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- 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.ie.InternetExplorerDriver;
- import org.openqa.selenium.support.ui.Select;
- public class tableldl {
- private WebDriver driver;
- private String baseUrl="";
- private StringBuffer verificationErrors = new StringBuffer();
- @Before
- public void setUp() throws Exception {
- driver = new FirefoxDriver();
- //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
- // driver.manage().setSpeed(Speed.slow);
- }
- @Test
- public void testTableldl() throws Exception {
- // ERROR: Caught exception [ERROR: Unsupported command [setSpeed]]
- driver.get("http://www.ldlcasino.com");
- Thread.sleep(30000);
- if (isElementPresent(By.id("close_welcome_box")))driver.findElement(By.id("close_welcome_box")).click();
- driver.findElement(By.id("dashTabOverlay")).click();
- Thread.sleep(30000);
- driver.findElement(By.id("obTable")).click();
- for (int second = 0;; second++) {
- if (second >= 60) fail("timeout");
- try { if (isElementPresent(By.id("time"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- Select select= new Select(driver.findElement(By.id("time")));
- select.selectByVisibleText("11:00PM");
- for (int second = 0;; second++) {
- if (second >= 60) fail("timeout");
- try { if (isElementPresent(By.id("checkAvailability"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.id("checkAvailability")).click();
- for (int second = 0;; second++) {
- if (second >= 60) fail("timeout");
- try { if (isElementPresent(By.id("booking_0"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- }
- @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;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement