Click on Facebook's "Keep me logged in" check box twice and then output the result as TRUE when it is toggled on, and FALSE if it is toggled off
1. First click check box was toggled on .
2. Second click check box was toggled off.
package dayOne;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FacebookChkbox {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
String baseUrl = "https://www.facebook.com/";
driver.get(baseUrl);
WebElement checkFBPersist = driver.findElement(By.id("persist_box"));
for (int i = 0; i<2; i++){
checkFBPersist.click();
System.out.println(checkFBPersist.isSelected());
}
driver.quit();
}
}
Good example explanation about selenium webdriver
ReplyDeleteThe information which you have provided is very good. It is very useful who is looking for selenium certification
ReplyDelete