Google+

Using Selenium Test Auotmation - Select 'Sing In' option from 'My Account' of VerizonWireless.com site

The below is the problem and solution code for selecting 'Sign In' option from the 'My Account' list on VerizonWireless.com site:

Problem:



Solution: 
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class Demo {
 
   public static void main(String[] args) {
  
        WebDriver driver = new FirefoxDriver();
  
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
        driver.get("https://www.verizonwireless.com/homepage/");
        
        //Below Actions are for moving mouse to My account drop-down
        Actions act = new Actions(driver);
        act.moveToElement(driver.findElement(By.id("gnavAccountMenu"))).build().perform();

        //To Click sign in button
        driver.findElement(By.linkText("Sign In")).click();
 
  
   }

}

No comments: