I have opened a search dialog box with the help of robot class but now I am trying to enter the text in that search dialog box but it is not entering the text with help of robot keypress.
The source code is as below
On Click of Add Row button as below a search dialog window opened up
driver.findElement(By.xpath("//*[@id=\"sale_dtl_ig_toolbar\"]/div[1]/div[6]/button")).click();
// Code to open search dialog box
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_S);
Thread.sleep(5000); // sometimes there may be a delay for the dialog box to get appeared
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
Dimension i = driver.manage().window().getSize();
System.out.println("Dimension x and y :"+i.getHeight()+","+i.getWidth());
int x = (i.getWidth()/4 )+ 20;
int y = (i.getHeight()/10)+ 50;
robot.mouseMove(x,y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
....................... upto this code search dialog window appears with one search dropdown
//driver.findElement(By.id("SEARCH")).sendKeys("");
//*[@id="SEARCH"] ............ here i had tried to locate the element but it is thowing exception unable to locate element
Then i used below code to type in the search field but it also doesn;t work
robot.keyPress(KeyEvent.VK_L);
robot.keyRelease(KeyEvent.VK_L);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_B);
robot.keyRelease(KeyEvent.VK_B);
robot.keyPress(KeyEvent.VK_O);
robot.keyRelease(KeyEvent.VK_O);
robot.keyPress(KeyEvent.VK_U);
robot.keyRelease(KeyEvent.VK_U);
robot.keyPress(KeyEvent.VK_R);
robot.keyRelease(KeyEvent.VK_R);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyPress(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_C);
robot.keyPress(KeyEvent.VK_H);
robot.keyRelease(KeyEvent.VK_H);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_R);
robot.keyRelease(KeyEvent.VK_R);
robot.keyPress(KeyEvent.VK_G);
robot.keyRelease(KeyEvent.VK_G);
robot.keyPress(KeyEvent.VK_E);
robot.keyRelease(KeyEvent.VK_E);
robot.keyPress(KeyEvent.VK_S);
robot.keyRelease(KeyEvent.VK_S);
sendKeys()
command? Also, can you give the error if any and the page HTML structure that would be helpful