Selenium-webdriver - how to pass a value in "TO" field



  • 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?



  • 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()
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2