Esempio n. 1
0
 /**
  * Check if element exist? Log: 0:not log result into result file. 1:log result into result file.
  *
  * @param dr
  * @param object
  * @param log
  * @return [boolean]
  */
 public boolean QIsElementPresent(WebDriver dr, By object, int log) {
   /*
    * log: 0:No Log Result	; 1:Log Result
    */
   try {
     dr.findElement(object);
     if (log == 1) {
       logStep("", "TRUE", "Check item Exist: " + object.toString());
     }
     return true;
   } catch (NotFoundException e) {
     if (log == 1) {
       logStep("", "TRUE", "Check item Exist: " + object.toString());
     }
     return false;
   }
 }
Esempio n. 2
0
  public static void main(String[] args) throws Exception {

    DesiredCapabilities capabillities = DesiredCapabilities.firefox();
    capabillities.setCapability("version", "8");
    capabillities.setCapability("platform", Platform.WINDOWS);

    WebDriver driver =
        new RemoteWebDriver(
            new URL(
                "http://*****:*****@hub.testingbot.com:4444/wd/hub"),
            capabillities);

    driver.get("http://www.google.com");
    WebElement search = driver.findElement(By.name("q"));
    search.sendKeys("Hello, WebDriver");
    search.submit();
    System.out.println(driver.getTitle());
    driver.quit();
  }