Tuesday 27 May 2014

WebDriver: check if an element exists or not?

IF you are a Selenium Web Driver  Automation tester than most probably you would have gone through this situation, In which you have faced one exception that speaks “Element not found”.

I Found Solution for this scenario........

Case 1:
 boolean elements ;
  elements = driver.findElements(By.name("masterPassword")).isEmpty();
  if(elements == true)
  {
     System.out.println("Element is not present");  
  }
  else
  {
           System.out.println("Element is present");  
          //Do whatever You want
  }

Here i am checking whether the element is present or not. Based on that I am writing if() {}and else{} blocks.

Angular JS Protractor Installation process - Tutorial Part 1

                     Protractor, formally known as E2E testing framework, is an open source functional automation framework designed spe...