1

I am trying to send email from rediffmail, but it failed to pass values in the "TO" field. Here is my code:

    System.setProperty("webdriver.chrome.driver", "F:\\chromedriver.exe");
    ChromeDriver driver = new ChromeDriver();
    driver.manage().window().maximize();
    driver.get("https://mail.rediff.com/cgi-bin/login.cgi");
    Thread.sleep(3000);
    driver.findElement(By.id("login1")).sendKeys("abcd");
    driver.findElement(By.name("passwd")).sendKeys("*****");
    driver.findElement(By.name("proceed")).click();

    // compose

    driver.findElementByXPath("//*[@id=\"boxscroll\"]/li[1]/a").click();
    Thread.sleep(3000);
    Actions action = new Actions(driver);
    action.sendKeys("xyz");

How can I pass a value to the "TO" field?

  • Why are you using actions to sendkeys , and not element.sendkeys – PDHide Dec 7 '19 at 17:40
1

I am not sure how you are identifying the TO field , once you successfully find and make it active, do the below steps.

Replace

action.sendKeys("xyz")

With

action.sendKeys("xyz").perform()
  • Cursor is already at TO field so i think there is no need to locate web element and this script also not working.....action.sendKeys("xyz").perform() – ayushi Dec 7 '19 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.