???JNA??????????????????????????????????
???????????? ???????[ 2013/4/8 10:11:16 ] ????????
?????????????????????????????£?1.public class Win32MessageConstants {
2.
3. public static final int WM_SETTEXT = 0x000C; //???????
4.
5. public static final int WM_CHAR = 0x0102; //???????
6.
7. public static final int BM_CLICK = 0xF5; //?????????????o????????????
8.
9. public static final int KEYEVENTF_KEYUP = 0x0002; //??????????
10.
11. public static final int KEYEVENTF_KEYDOWN = 0x0; //???????????
12.
13.}
????????д??β?????????????????????????????????????????£?
1.import java.util.concurrent.TimeUnit;
2.
3.import static org.hamcrest.core.Is.is;
4.import static org.junit.Assert.assertThat;
5.
6.import static org.hamcrest.core.IsNull.notNullValue;
7.import org.junit.Test;
8.
9.import com.sun.jna.platform.win32.WinDef;
10.import com.sun.jna.platform.win32.WinDef.HWND;
11.
12.public class AlipayPasswordInputTest {
13.
14. @Test
15. public void testAlipayPasswordInput() {
16. String password = "your password";
17. HWND alipayEdit = findHandle("Chrome_RenderWidgetHostHWND"?? "Edit"); //Chrome??????????Spy++??????????????
18. assertThat("??????????????????"?? alipayEdit?? notNullValue());
19. boolean isSuccess = Win32Util.simulateCharInput(alipayEdit?? password);
20. assertThat("?????????????["+ password +"]????"?? isSuccess?? is(true));
21. }
22.
23. private WinDef.HWND findHandle(String browserClassName?? String alieditClassName) {
24. WinDef.HWND browser = Win32Util.findHandleByClassName(browserClassName?? 10?? TimeUnit.SECONDS);
25. return Win32Util.findHandleByClassName(browser?? alieditClassName?? 10?? TimeUnit.SECONDS);
26. }
27.}
??????????£???????????????????
???????????????????????κη??????в???????????Щ??????????????????
????1??sendMessage??postMessage?к??????????????????????Ч?????????Win32Util???????????????????????????????£????????
????2????????????????????????????????????а?????????????????????????Firefox???????????????
????3?????????API??????MAC??UNIX??WINDOWS????????????????windows?????????У?????????
????4???????????????????????Chrome?????????????????????????????????????????????????????????????????
????5??????????Selenium??RemoteDriver?????????????????????н??????????????Ч?????remoteDriver????http?????????????API??????????????????????????Http Command????????Ч??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11