1

I am trying to automate a page [Link]https://qlb21.resources.hewitt.com/cl77ybr5qc/ybr5cl772b/CsLogn010InptOpen.do?fTkn=539f4eddc99aef9eb1c8da11d13a3654&fWdw=intro&eWlmYBR5ClntId=00398&wdw=primary&fPg=%2FCsLogn005WelcOpen. After clicking on the above link you will get a prompt.That prompt now i am able to handle but after clicking on continue button on the iframe the Home Page is showing userid and password on that UserId textbox i tried to send using sendkeys but in vain

`

    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.support.FindBy;
    import org.openqa.selenium.support.PageFactory;

    import com.selenium.commons.Configuration;

     public class Home {
     public WebDriver driver = Configuration.driver;


@FindBy(id="usrId")
private WebElement user;

@FindBy(id="pswd")
private WebElement pswd;

@FindBy(id="tranId'")
private WebElement tranId;

@FindBy(id="logOn")
private WebElement logOn;

public Home()
{       
    PageFactory.initElements(Configuration.driver, this);

}

public void logon(String Username,String Password,String trns)
{
    Configuration.driver.get(Configuration.URL);
    Configuration.driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS);

    try{
        Thread.sleep(10000);
    }
    catch(Exception e)
    {

    }

    Configuration.driver.switchTo().frame(Configuration.driver.findElement(By.xpath("//iframe[@id='lightbox_iframe_cookieBanner']")));
    Configuration.driver.findElement(By.xpath("//a[text()='Continue']")).click();
    driver.manage().window().maximize();
    System.out.println(driver.getTitle());
    driver.findElement(By.id("usrId")).sendKeys("Babita Sethi");

}

`

2 Answers 2

3

You should switch back from iframe as well, before doing the user name field lookup, do something like:

driver.switchTo().defaultContent();
Sign up to request clarification or add additional context in comments.

1 Comment

In stackoverflow, instead of saying thanks, we upvote/accept.
0

That prompt is in iframe. but home page is not in iframe. Whenever if you want to perform actions on homepage you should switch back to the default content. i.e driver.switchTo().defaultContent();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.