Showing posts with label How to automate Gmail. Show all posts
Showing posts with label How to automate Gmail. Show all posts

Mouse Hover in selenium



public static void main(String[] args) throws InterruptedException {

WebDriver driver = new FirefoxDriver();
driver.get("http://www.timeanddate.com/");
driver.manage().window().maximize();
WebElement menu = driver.findElement(By.xpath("//*[@id='nav']/ul/li[3]/a"));
Actions action = new Actions(driver);
action.moveToElement(menu).perform();
WebElement submenu = driver.findElement(By.xpath("//*[@id='nav']/ul/li[3]/ul/li[4]/a"));
action.moveToElement(submenu).click().perform();

Thread.sleep(5000);
driver.close();
}

For any queries, ContactUs

How to Login and Logout in Gmail

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Openbrowser
{
public static void main(String args[]) throws InterruptedException
{
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.get("http://gmail.com/");
driver.findElement(By.id("Email")).sendKeys("raghav@mobikwik.com");
driver.findElement(By.id("Passwd")).sendKeys("9910979218");
driver.findElement(By.id("signIn")).click();
Thread.sleep(4000);
driver.findElement(By.xpath("//*[@id='gb']/div[1]/div[1]/div[2]/div[5]/div[1]/a/span")).click();
driver.findElement(By.id("gb_71")).click();
}
}