About Me

Page views

Powered by Blogger.

Followers

Thursday 30 April 2015



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();
}

}



2 comments:

  1. The information which you have provided is very good. It is very useful who is looking for selenium certification

    ReplyDelete

Popular Posts

Copyright © Learn Selenium Yourself | Powered by Blogger
Design by Duan Zhiyan | Blogger Theme by NewBloggerThemes.com