Getting Access is denied Error while send keys

0

I have a code which enters value in text box and hits on enter. I m getting Access denied error when Enter is pressed with sendkeys.

I have tried including Thread.sleep(2000) post set focus window.

Observation is that window is in focus only and I can see the text getting setted to the search text box.

Not sure why send keys fails.

This is code was running fine, and it runs fine intermittently. I welcome any help on this.

HTMLDocument doc= (HTMLDocument)browserObj.document;
HTMLInputElement searchTextBox=doc.getElementById("id1"));
searchTextbox.Click();
searchTextbox.setFocus();
searchTextbox.SetAttribute("innerText","12345");
//calling Set focus method for setting focus to browser.
    SendKeys.sendWait("{Enter}");

I expect enter key to be pressed, instead I am getting access denied error.

System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Windows.Forms.SendKeys.SendInput(Byte[] oldKeyboardState, Queue previousEvents) at System.Windows.Forms.SendKeys.Send(String keys, Control control, Boolean wait) at System.Windows.Forms.SendKeys.SendWait(String keys)

c#

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0