In automated testing we can not avoid to imitate some keyboard buttons on the operation, ordinary letters, numbers, special symbols, these are very simple, and sometimes we will imitate "SHIFT", "ALT", "CONTROL", these selenium has provided the action, Specific as follows:
New Actions (driver); Actions.keydown (Keys.control); // Press to release control Actions.keydown (keys.control); Actions.keydown (keys.shift); // Press to release shift Actions.keydown (keys.shift); Actions.keydown (Keys.alt); // Press to release Alt Actions.keydown (keys.alt); Actions.keydown (keys.tab); // Press to release tab Actions.keydown (Keys.tab);
But when we enter some text in the text box, or do some other action, and then click on Entey execution, it will not work as above, because selenium does not provide this kind of operation, specifically.
The solution is as follows:
Driver.findelement (by.id ("name")). SendKeys ("* * *");d river.findelement (by.id ("name")). SendKeys (" Keys.enter ");
Java+selenium "ENTRY" that mimics the keyboard after entering content into the text box