Please can some one help me to write script for popup windows for redbus

Answered

The url is https://www.redbus.in/
I am struck on sign up popup..I don’t know how to write script for login using the google

Add Comment
  • 1 Answer(s)
    Best answer

    Hi? I have written completed test class for you.
    //navigate to index page.
    driver.get(“https://www.redbus.in/”);

    //click on signIn link.
    WebElement signInLink = driver.findElement(By.id(“signInLink”));
    signInLink.click();

    //Switch to last iframe, and some wait until page loaded all frames, but no more than 10 sec.
    List<WebElement> frames;
    try {
    Thread.sleep(10000);
    }catch (InterruptedException e){}

    frames = driver.findElements(By.tagName(“iframe”));

    driver.switchTo().frame(frames.get(frames.size()-1));

    //Select google.
    WebElement googleButton = driver.findElement(By.id(“googlePlusBtn”));
    googleButton.click();

    //Switch to last window.
    for (String win:driver.getWindowHandles()){
    driver.switchTo().window(win);
    }
    //Verify redirect to the google authorization window.
    System.out.println(driver.getCurrentUrl());

     

    If you have some questions just ask)

    Wait for feedback.

    Reviewer Answered on July 9, 2015.

    It’s working fine. I got the concept now….Thank you so much victor

    on July 10, 2015.

    you are welcome)

    on July 10, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.