Automation Using Selenium Webdriver
Showing posts with label Login-logout linkedin Using Selenium webdrier. Show all posts
Showing posts with label Login-logout linkedin Using Selenium webdrier. Show all posts

Monday 17 October 2016

Linkedin Login-Logout Using Selenium webdrier


Linkedin Sign in-Sign out Example Using Selenium Webdriver

   public class LinkedIn
 {
    WebDriver driver = new FirefoxDriver();
    @BeforeTest
    public void setUp() throws Exception {

        String baseUrl = "http://www.linkedin.com/";  
        driver.get(baseUrl);

    }


    @Test
    public void login() throws InterruptedException
    {
        WebElement login = driver.findElement(By.id("login-email"));
        login.sendKeys("*****@gmail.com");

        WebElement pwd = driver.findElement(By.id("login-password"));
        pwd.sendKeys("*****");


        WebElement in = driver.findElement(By.name("submit"));
        in.click();

        Thread.sleep(10000);
    }


     @Test
        public void profile()  {
    // here it gives error to me : Unable to locate element
        Thread.sleep(5000);
        Actions action = new Actions(driver);
        WebElement profile = driver.findElement(By.xpath("//*[@id='img-defer-id-1-25469']"));
        action.moveToElement(profile).build().perform();
        driver.quit();
    }


}