Showing posts with label Handle Radio Box. Show all posts
Showing posts with label Handle Radio Box. Show all posts

Difference Between Implicit Wait and Explicit Wait


Implicit Wait – 

An implicit wait is to tell WebDriver to stop the DOM for a certain amount of time. The default setting is 0. 

Syntax – driver.manage().timeouts().Implicitly Wait(10, TimeUnit.SECONDS); 

Explicit Wait - 

How to Automate CheckBox/RadioButton Using Selenium WebDriver

 

// How to automate CheckBox/RadioButton

 import org.openqa.selenium.By;  
 import org.openqa.selenium.WebDriver;  
 import org.openqa.selenium.firefox.FirefoxDriver;  
 public class CheckBox {  
      public static void main(String[] args) throws InterruptedException {  
           WebDriver driver = new FirefoxDriver();  
           String Url = "https://www.facebook.com/";  
           driver.get(Url);  
           Boolean select = driver.findElement(By.xpath("//*[@id='persist_box']")).isSelected();  
           if (select == false)  
           {  
                driver.findElement(By.xpath("//*[@id='persist_box']")).click();  
           }  
           Thread.sleep(5000);  
 driver.close();            
      }  
 }