Best Puppeteer-sharp code snippet using PuppeteerSharp.Input.KeyDefinition
KeyDefinitions.cs
Source:KeyDefinitions.cs
1using System.Collections.Generic;2namespace PuppeteerSharp.Input3{4 internal static class KeyDefinitions5 {6 private static readonly Dictionary<string, KeyDefinition> Definitions = new Dictionary<string, KeyDefinition>7 {8 ["0"] = new KeyDefinition9 {10 KeyCode = 48,11 Key = "0",12 Code = "Digit0"13 },14 ["1"] = new KeyDefinition15 {16 KeyCode = 49,17 Key = "1",18 Code = "Digit1"19 },20 ["2"] = new KeyDefinition21 {22 KeyCode = 50,23 Key = "2",24 Code = "Digit2"25 },26 ["3"] = new KeyDefinition27 {28 KeyCode = 51,29 Key = "3",30 Code = "Digit3"31 },32 ["4"] = new KeyDefinition33 {34 KeyCode = 52,35 Key = "4",36 Code = "Digit4"37 },38 ["5"] = new KeyDefinition39 {40 KeyCode = 53,41 Key = "5",42 Code = "Digit5"43 },44 ["6"] = new KeyDefinition45 {46 KeyCode = 54,47 Key = "6",48 Code = "Digit6"49 },50 ["7"] = new KeyDefinition51 {52 KeyCode = 55,53 Key = "7",54 Code = "Digit7"55 },56 ["8"] = new KeyDefinition57 {58 KeyCode = 56,59 Key = "8",60 Code = "Digit8"61 },62 ["9"] = new KeyDefinition63 {64 KeyCode = 57,65 Key = "9",66 Code = "Digit9"67 },68 ["Power"] = new KeyDefinition69 {70 Key = "Power",71 Code = "Power"72 },73 ["Eject"] = new KeyDefinition74 {75 Key = "Eject",76 Code = "Eject"77 },78 ["Abort"] = new KeyDefinition79 {80 KeyCode = 3,81 Key = "Cancel",82 Code = "Abort"83 },84 ["Help"] = new KeyDefinition85 {86 KeyCode = 6,87 Key = "Help",88 Code = "Help"89 },90 ["Backspace"] = new KeyDefinition91 {92 KeyCode = 8,93 Key = "Backspace",94 Code = "Backspace"95 },96 ["Tab"] = new KeyDefinition97 {98 KeyCode = 9,99 Key = "Tab",100 Code = "Tab"101 },102 ["Numpad5"] = new KeyDefinition103 {104 KeyCode = 12,105 ShiftKeyCode = 101,106 Key = "Clear",107 ShiftKey = "5",108 Code = "Numpad5",109 Location = 3110 },111 ["NumpadEnter"] = new KeyDefinition112 {113 KeyCode = 13,114 Key = "Enter",115 Code = "NumpadEnter",116 Text = "\r",117 Location = 3118 },119 ["Enter"] = new KeyDefinition120 {121 KeyCode = 13,122 Key = "Enter",123 Code = "Enter",124 Text = "\r"125 },126 ["\r"] = new KeyDefinition127 {128 KeyCode = 13,129 Key = "Enter",130 Code = "Enter",131 Text = "\r"132 },133 ["\n"] = new KeyDefinition134 {135 KeyCode = 13,136 Key = "Enter",137 Code = "Enter",138 Text = "\r"139 },140 ["ShiftLeft"] = new KeyDefinition141 {142 KeyCode = 16,143 Key = "Shift",144 Code = "ShiftLeft",145 Location = 1146 },147 ["ShiftRight"] = new KeyDefinition148 {149 KeyCode = 16,150 Key = "Shift",151 Code = "ShiftRight",152 Location = 2153 },154 ["ControlLeft"] = new KeyDefinition155 {156 KeyCode = 17,157 Key = "Control",158 Code = "ControlLeft",159 Location = 1160 },161 ["ControlRight"] = new KeyDefinition162 {163 KeyCode = 17,164 Key = "Control",165 Code = "ControlRight",166 Location = 2167 },168 ["AltLeft"] = new KeyDefinition169 {170 KeyCode = 18,171 Key = "Alt",172 Code = "AltLeft",173 Location = 1174 },175 ["AltRight"] = new KeyDefinition176 {177 KeyCode = 18,178 Key = "Alt",179 Code = "AltRight",180 Location = 2181 },182 ["Pause"] = new KeyDefinition183 {184 KeyCode = 19,185 Key = "Pause",186 Code = "Pause"187 },188 ["CapsLock"] = new KeyDefinition189 {190 KeyCode = 20,191 Key = "CapsLock",192 Code = "CapsLock"193 },194 ["Escape"] = new KeyDefinition195 {196 KeyCode = 27,197 Key = "Escape",198 Code = "Escape"199 },200 ["Convert"] = new KeyDefinition201 {202 KeyCode = 28,203 Key = "Convert",204 Code = "Convert"205 },206 ["NonConvert"] = new KeyDefinition207 {208 KeyCode = 29,209 Key = "NonConvert",210 Code = "NonConvert"211 },212 ["Space"] = new KeyDefinition213 {214 KeyCode = 32,215 Key = " ",216 Code = "Space"217 },218 ["Numpad9"] = new KeyDefinition219 {220 KeyCode = 33,221 ShiftKeyCode = 105,222 Key = "PageUp",223 ShiftKey = "9",224 Code = "Numpad9",225 Location = 3226 },227 ["PageUp"] = new KeyDefinition228 {229 KeyCode = 33,230 Key = "PageUp",231 Code = "PageUp"232 },233 ["Numpad3"] = new KeyDefinition234 {235 KeyCode = 34,236 ShiftKeyCode = 99,237 Key = "PageDown",238 ShiftKey = "3",239 Code = "Numpad3",240 Location = 3241 },242 ["PageDown"] = new KeyDefinition243 {244 KeyCode = 34,245 Key = "PageDown",246 Code = "PageDown"247 },248 ["End"] = new KeyDefinition249 {250 KeyCode = 35,251 Key = "End",252 Code = "End"253 },254 ["Numpad1"] = new KeyDefinition255 {256 KeyCode = 35,257 ShiftKeyCode = 97,258 Key = "End",259 ShiftKey = "1",260 Code = "Numpad1",261 Location = 3262 },263 ["Home"] = new KeyDefinition264 {265 KeyCode = 36,266 Key = "Home",267 Code = "Home"268 },269 ["Numpad7"] = new KeyDefinition270 {271 KeyCode = 36,272 ShiftKeyCode = 103,273 Key = "Home",274 ShiftKey = "7",275 Code = "Numpad7",276 Location = 3277 },278 ["ArrowLeft"] = new KeyDefinition279 {280 KeyCode = 37,281 Key = "ArrowLeft",282 Code = "ArrowLeft"283 },284 ["Numpad4"] = new KeyDefinition285 {286 KeyCode = 37,287 ShiftKeyCode = 100,288 Key = "ArrowLeft",289 ShiftKey = "4",290 Code = "Numpad4",291 Location = 3292 },293 ["Numpad8"] = new KeyDefinition294 {295 KeyCode = 38,296 ShiftKeyCode = 104,297 Key = "ArrowUp",298 ShiftKey = "8",299 Code = "Numpad8",300 Location = 3301 },302 ["ArrowUp"] = new KeyDefinition303 {304 KeyCode = 38,305 Key = "ArrowUp",306 Code = "ArrowUp"307 },308 ["ArrowRight"] = new KeyDefinition309 {310 KeyCode = 39,311 Key = "ArrowRight",312 Code = "ArrowRight"313 },314 ["Numpad6"] = new KeyDefinition315 {316 KeyCode = 39,317 ShiftKeyCode = 102,318 Key = "ArrowRight",319 ShiftKey = "6",320 Code = "Numpad6",321 Location = 3322 },323 ["Numpad2"] = new KeyDefinition324 {325 KeyCode = 40,326 ShiftKeyCode = 98,327 Key = "ArrowDown",328 ShiftKey = "2",329 Code = "Numpad2",330 Location = 3331 },332 ["ArrowDown"] = new KeyDefinition333 {334 KeyCode = 40,335 Key = "ArrowDown",336 Code = "ArrowDown"337 },338 ["Select"] = new KeyDefinition339 {340 KeyCode = 41,341 Key = "Select",342 Code = "Select"343 },344 ["Open"] = new KeyDefinition345 {346 KeyCode = 43,347 Key = "Execute",348 Code = "Open"349 },350 ["PrintScreen"] = new KeyDefinition351 {352 KeyCode = 44,353 Key = "PrintScreen",354 Code = "PrintScreen"355 },356 ["Insert"] = new KeyDefinition357 {358 KeyCode = 45,359 Key = "Insert",360 Code = "Insert"361 },362 ["Numpad0"] = new KeyDefinition363 {364 KeyCode = 45,365 ShiftKeyCode = 96,366 Key = "Insert",367 ShiftKey = "0",368 Code = "Numpad0",369 Location = 3370 },371 ["Delete"] = new KeyDefinition372 {373 KeyCode = 46,374 Key = "Delete",375 Code = "Delete"376 },377 ["NumpadDecimal"] = new KeyDefinition378 {379 KeyCode = 46,380 ShiftKeyCode = 110,381 Key = "\u0000",382 ShiftKey = ".",383 Code = "NumpadDecimal",384 Location = 3385 },386 ["Digit0"] = new KeyDefinition387 {388 KeyCode = 48,389 Key = "0",390 ShiftKey = ")",391 Code = "Digit0"392 },393 ["Digit1"] = new KeyDefinition394 {395 KeyCode = 49,396 Key = "1",397 ShiftKey = "!",398 Code = "Digit1"399 },400 ["Digit2"] = new KeyDefinition401 {402 KeyCode = 50,403 Key = "2",404 ShiftKey = "@",405 Code = "Digit2"406 },407 ["Digit3"] = new KeyDefinition408 {409 KeyCode = 51,410 Key = "3",411 ShiftKey = "#",412 Code = "Digit3"413 },414 ["Digit4"] = new KeyDefinition415 {416 KeyCode = 52,417 Key = "4",418 ShiftKey = "$",419 Code = "Digit4"420 },421 ["Digit5"] = new KeyDefinition422 {423 KeyCode = 53,424 Key = "5",425 ShiftKey = "%",426 Code = "Digit5"427 },428 ["Digit6"] = new KeyDefinition429 {430 KeyCode = 54,431 Key = "6",432 ShiftKey = "^",433 Code = "Digit6"434 },435 ["Digit7"] = new KeyDefinition436 {437 KeyCode = 55,438 Key = "7",439 ShiftKey = "&",440 Code = "Digit7"441 },442 ["Digit8"] = new KeyDefinition443 {444 KeyCode = 56,445 Key = "8",446 ShiftKey = "*",447 Code = "Digit8"448 },449 ["Digit9"] = new KeyDefinition450 {451 KeyCode = 57,452 Key = "9",453 ShiftKey = "(",454 Code = "Digit9"455 },456 ["KeyA"] = new KeyDefinition457 {458 KeyCode = 65,459 Key = "a",460 ShiftKey = "A",461 Code = "KeyA"462 },463 ["KeyB"] = new KeyDefinition464 {465 KeyCode = 66,466 Key = "b",467 ShiftKey = "B",468 Code = "KeyB"469 },470 ["KeyC"] = new KeyDefinition471 {472 KeyCode = 67,473 Key = "c",474 ShiftKey = "C",475 Code = "KeyC"476 },477 ["KeyD"] = new KeyDefinition478 {479 KeyCode = 68,480 Key = "d",481 ShiftKey = "D",482 Code = "KeyD"483 },484 ["KeyE"] = new KeyDefinition485 {486 KeyCode = 69,487 Key = "e",488 ShiftKey = "E",489 Code = "KeyE"490 },491 ["KeyF"] = new KeyDefinition492 {493 KeyCode = 70,494 Key = "f",495 ShiftKey = "F",496 Code = "KeyF"497 },498 ["KeyG"] = new KeyDefinition499 {500 KeyCode = 71,501 Key = "g",502 ShiftKey = "G",503 Code = "KeyG"504 },505 ["KeyH"] = new KeyDefinition506 {507 KeyCode = 72,508 Key = "h",509 ShiftKey = "H",510 Code = "KeyH"511 },512 ["KeyI"] = new KeyDefinition513 {514 KeyCode = 73,515 Key = "i",516 ShiftKey = "I",517 Code = "KeyI"518 },519 ["KeyJ"] = new KeyDefinition520 {521 KeyCode = 74,522 Key = "j",523 ShiftKey = "J",524 Code = "KeyJ"525 },526 ["KeyK"] = new KeyDefinition527 {528 KeyCode = 75,529 Key = "k",530 ShiftKey = "K",531 Code = "KeyK"532 },533 ["KeyL"] = new KeyDefinition534 {535 KeyCode = 76,536 Key = "l",537 ShiftKey = "L",538 Code = "KeyL"539 },540 ["KeyM"] = new KeyDefinition541 {542 KeyCode = 77,543 Key = "m",544 ShiftKey = "M",545 Code = "KeyM"546 },547 ["KeyN"] = new KeyDefinition548 {549 KeyCode = 78,550 Key = "n",551 ShiftKey = "N",552 Code = "KeyN"553 },554 ["KeyO"] = new KeyDefinition555 {556 KeyCode = 79,557 Key = "o",558 ShiftKey = "O",559 Code = "KeyO"560 },561 ["KeyP"] = new KeyDefinition562 {563 KeyCode = 80,564 Key = "p",565 ShiftKey = "P",566 Code = "KeyP"567 },568 ["KeyQ"] = new KeyDefinition569 {570 KeyCode = 81,571 Key = "q",572 ShiftKey = "Q",573 Code = "KeyQ"574 },575 ["KeyR"] = new KeyDefinition576 {577 KeyCode = 82,578 Key = "r",579 ShiftKey = "R",580 Code = "KeyR"581 },582 ["KeyS"] = new KeyDefinition583 {584 KeyCode = 83,585 Key = "s",586 ShiftKey = "S",587 Code = "KeyS"588 },589 ["KeyT"] = new KeyDefinition590 {591 KeyCode = 84,592 Key = "t",593 ShiftKey = "T",594 Code = "KeyT"595 },596 ["KeyU"] = new KeyDefinition597 {598 KeyCode = 85,599 Key = "u",600 ShiftKey = "U",601 Code = "KeyU"602 },603 ["KeyV"] = new KeyDefinition604 {605 KeyCode = 86,606 Key = "v",607 ShiftKey = "V",608 Code = "KeyV"609 },610 ["KeyW"] = new KeyDefinition611 {612 KeyCode = 87,613 Key = "w",614 ShiftKey = "W",615 Code = "KeyW"616 },617 ["KeyX"] = new KeyDefinition618 {619 KeyCode = 88,620 Key = "x",621 ShiftKey = "X",622 Code = "KeyX"623 },624 ["KeyY"] = new KeyDefinition625 {626 KeyCode = 89,627 Key = "y",628 ShiftKey = "Y",629 Code = "KeyY"630 },631 ["KeyZ"] = new KeyDefinition632 {633 KeyCode = 90,634 Key = "z",635 ShiftKey = "Z",636 Code = "KeyZ"637 },638 ["MetaLeft"] = new KeyDefinition639 {640 KeyCode = 91,641 Key = "Meta",642 Code = "MetaLeft"643 },644 ["MetaRight"] = new KeyDefinition645 {646 KeyCode = 92,647 Key = "Meta",648 Code = "MetaRight"649 },650 ["ContextMenu"] = new KeyDefinition651 {652 KeyCode = 93,653 Key = "ContextMenu",654 Code = "ContextMenu"655 },656 ["NumpadMultiply"] = new KeyDefinition657 {658 KeyCode = 106,659 Key = "*",660 Code = "NumpadMultiply",661 Location = 3662 },663 ["NumpadAdd"] = new KeyDefinition664 {665 KeyCode = 107,666 Key = "+",667 Code = "NumpadAdd",668 Location = 3669 },670 ["NumpadSubtract"] = new KeyDefinition671 {672 KeyCode = 109,673 Key = "-",674 Code = "NumpadSubtract",675 Location = 3676 },677 ["NumpadDivide"] = new KeyDefinition678 {679 KeyCode = 111,680 Key = "/",681 Code = "NumpadDivide",682 Location = 3683 },684 ["F1"] = new KeyDefinition685 {686 KeyCode = 112,687 Key = "F1",688 Code = "F1"689 },690 ["F2"] = new KeyDefinition691 {692 KeyCode = 113,693 Key = "F2",694 Code = "F2"695 },696 ["F3"] = new KeyDefinition697 {698 KeyCode = 114,699 Key = "F3",700 Code = "F3"701 },702 ["F4"] = new KeyDefinition703 {704 KeyCode = 115,705 Key = "F4",706 Code = "F4"707 },708 ["F5"] = new KeyDefinition709 {710 KeyCode = 116,711 Key = "F5",712 Code = "F5"713 },714 ["F6"] = new KeyDefinition715 {716 KeyCode = 117,717 Key = "F6",718 Code = "F6"719 },720 ["F7"] = new KeyDefinition721 {722 KeyCode = 118,723 Key = "F7",724 Code = "F7"725 },726 ["F8"] = new KeyDefinition727 {728 KeyCode = 119,729 Key = "F8",730 Code = "F8"731 },732 ["F9"] = new KeyDefinition733 {734 KeyCode = 120,735 Key = "F9",736 Code = "F9"737 },738 ["F10"] = new KeyDefinition739 {740 KeyCode = 121,741 Key = "F10",742 Code = "F10"743 },744 ["F11"] = new KeyDefinition745 {746 KeyCode = 122,747 Key = "F11",748 Code = "F11"749 },750 ["F12"] = new KeyDefinition751 {752 KeyCode = 123,753 Key = "F12",754 Code = "F12"755 },756 ["F13"] = new KeyDefinition757 {758 KeyCode = 124,759 Key = "F13",760 Code = "F13"761 },762 ["F14"] = new KeyDefinition763 {764 KeyCode = 125,765 Key = "F14",766 Code = "F14"767 },768 ["F15"] = new KeyDefinition769 {770 KeyCode = 126,771 Key = "F15",772 Code = "F15"773 },774 ["F16"] = new KeyDefinition775 {776 KeyCode = 127,777 Key = "F16",778 Code = "F16"779 },780 ["F17"] = new KeyDefinition781 {782 KeyCode = 128,783 Key = "F17",784 Code = "F17"785 },786 ["F18"] = new KeyDefinition787 {788 KeyCode = 129,789 Key = "F18",790 Code = "F18"791 },792 ["F19"] = new KeyDefinition793 {794 KeyCode = 130,795 Key = "F19",796 Code = "F19"797 },798 ["F20"] = new KeyDefinition799 {800 KeyCode = 131,801 Key = "F20",802 Code = "F20"803 },804 ["F21"] = new KeyDefinition805 {806 KeyCode = 132,807 Key = "F21",808 Code = "F21"809 },810 ["F22"] = new KeyDefinition811 {812 KeyCode = 133,813 Key = "F22",814 Code = "F22"815 },816 ["F23"] = new KeyDefinition817 {818 KeyCode = 134,819 Key = "F23",820 Code = "F23"821 },822 ["F24"] = new KeyDefinition823 {824 KeyCode = 135,825 Key = "F24",826 Code = "F24"827 },828 ["NumLock"] = new KeyDefinition829 {830 KeyCode = 144,831 Key = "NumLock",832 Code = "NumLock"833 },834 ["ScrollLock"] = new KeyDefinition835 {836 KeyCode = 145,837 Key = "ScrollLock",838 Code = "ScrollLock"839 },840 ["AudioVolumeMute"] = new KeyDefinition841 {842 KeyCode = 173,843 Key = "AudioVolumeMute",844 Code = "AudioVolumeMute"845 },846 ["AudioVolumeDown"] = new KeyDefinition847 {848 KeyCode = 174,849 Key = "AudioVolumeDown",850 Code = "AudioVolumeDown"851 },852 ["AudioVolumeUp"] = new KeyDefinition853 {854 KeyCode = 175,855 Key = "AudioVolumeUp",856 Code = "AudioVolumeUp"857 },858 ["MediaTrackNext"] = new KeyDefinition859 {860 KeyCode = 176,861 Key = "MediaTrackNext",862 Code = "MediaTrackNext"863 },864 ["MediaTrackPrevious"] = new KeyDefinition865 {866 KeyCode = 177,867 Key = "MediaTrackPrevious",868 Code = "MediaTrackPrevious"869 },870 ["MediaStop"] = new KeyDefinition871 {872 KeyCode = 178,873 Key = "MediaStop",874 Code = "MediaStop"875 },876 ["MediaPlayPause"] = new KeyDefinition877 {878 KeyCode = 179,879 Key = "MediaPlayPause",880 Code = "MediaPlayPause"881 },882 ["Semicolon"] = new KeyDefinition883 {884 KeyCode = 186,885 Key = ";",886 ShiftKey = ":",887 Code = "Semicolon"888 },889 ["Equal"] = new KeyDefinition890 {891 KeyCode = 187,892 Key = "=",893 ShiftKey = "+",894 Code = "Equal"895 },896 ["NumpadEqual"] = new KeyDefinition897 {898 KeyCode = 187,899 Key = "=",900 Code = "NumpadEqual",901 Location = 3902 },903 ["Comma"] = new KeyDefinition904 {905 KeyCode = 188,906 Key = ",",907 ShiftKey = "<",908 Code = "Comma"909 },910 ["Minus"] = new KeyDefinition911 {912 KeyCode = 189,913 Key = "-",914 ShiftKey = "_",915 Code = "Minus"916 },917 ["Period"] = new KeyDefinition918 {919 KeyCode = 190,920 Key = ".",921 ShiftKey = ">",922 Code = "Period"923 },924 ["Slash"] = new KeyDefinition925 {926 KeyCode = 191,927 Key = "/",928 ShiftKey = "?",929 Code = "Slash"930 },931 ["Backquote"] = new KeyDefinition932 {933 KeyCode = 192,934 Key = "`",935 ShiftKey = "~",936 Code = "Backquote"937 },938 ["BracketLeft"] = new KeyDefinition939 {940 KeyCode = 219,941 Key = "[",942 ShiftKey = "{",943 Code = "BracketLeft"944 },945 ["Backslash"] = new KeyDefinition946 {947 KeyCode = 220,948 Key = "\\",949 ShiftKey = "|",950 Code = "Backslash"951 },952 ["BracketRight"] = new KeyDefinition953 {954 KeyCode = 221,955 Key = "]",956 ShiftKey = "}",957 Code = "BracketRight"958 },959 ["Quote"] = new KeyDefinition960 {961 KeyCode = 222,962 Key = "'",963 ShiftKey = "\"",964 Code = "Quote"965 },966 ["AltGraph"] = new KeyDefinition967 {968 KeyCode = 225,969 Key = "AltGraph",970 Code = "AltGraph"971 },972 ["Props"] = new KeyDefinition973 {974 KeyCode = 247,975 Key = "CrSel",976 Code = "Props"977 },978 ["Cancel"] = new KeyDefinition979 {980 KeyCode = 3,981 Key = "Cancel",982 Code = "Abort"983 },984 ["Clear"] = new KeyDefinition985 {986 KeyCode = 12,987 Key = "Clear",988 Code = "Numpad5",989 Location = 3990 },991 ["Shift"] = new KeyDefinition992 {993 KeyCode = 16,994 Key = "Shift",995 Code = "ShiftLeft"996 },997 ["Control"] = new KeyDefinition998 {999 KeyCode = 17,1000 Key = "Control",1001 Code = "ControlLeft"1002 },1003 ["Alt"] = new KeyDefinition1004 {1005 KeyCode = 18,1006 Key = "Alt",1007 Code = "AltLeft"1008 },1009 ["Accept"] = new KeyDefinition1010 {1011 KeyCode = 30,1012 Key = "Accept"1013 },1014 ["ModeChange"] = new KeyDefinition1015 {1016 KeyCode = 31,1017 Key = "ModeChange"1018 },1019 [" "] = new KeyDefinition1020 {1021 KeyCode = 32,1022 Key = " ",1023 Code = "Space"1024 },1025 ["Print"] = new KeyDefinition1026 {1027 KeyCode = 42,1028 Key = "Print"1029 },1030 ["Execute"] = new KeyDefinition1031 {1032 KeyCode = 43,1033 Key = "Execute",1034 Code = "Open"1035 },1036 ["\u0000"] = new KeyDefinition1037 {1038 KeyCode = 46,1039 Key = "\u0000",1040 Code = "NumpadDecimal",1041 Location = 31042 },1043 ["a"] = new KeyDefinition1044 {1045 KeyCode = 65,1046 Key = "a",1047 Code = "KeyA"1048 },1049 ["b"] = new KeyDefinition1050 {1051 KeyCode = 66,1052 Key = "b",1053 Code = "KeyB"1054 },1055 ["c"] = new KeyDefinition1056 {1057 KeyCode = 67,1058 Key = "c",1059 Code = "KeyC"1060 },1061 ["d"] = new KeyDefinition1062 {1063 KeyCode = 68,1064 Key = "d",1065 Code = "KeyD"1066 },1067 ["e"] = new KeyDefinition1068 {1069 KeyCode = 69,1070 Key = "e",1071 Code = "KeyE"1072 },1073 ["f"] = new KeyDefinition1074 {1075 KeyCode = 70,1076 Key = "f",1077 Code = "KeyF"1078 },1079 ["g"] = new KeyDefinition1080 {1081 KeyCode = 71,1082 Key = "g",1083 Code = "KeyG"1084 },1085 ["h"] = new KeyDefinition1086 {1087 KeyCode = 72,1088 Key = "h",1089 Code = "KeyH"1090 },1091 ["i"] = new KeyDefinition1092 {1093 KeyCode = 73,1094 Key = "i",1095 Code = "KeyI"1096 },1097 ["j"] = new KeyDefinition1098 {1099 KeyCode = 74,1100 Key = "j",1101 Code = "KeyJ"1102 },1103 ["k"] = new KeyDefinition1104 {1105 KeyCode = 75,1106 Key = "k",1107 Code = "KeyK"1108 },1109 ["l"] = new KeyDefinition1110 {1111 KeyCode = 76,1112 Key = "l",1113 Code = "KeyL"1114 },1115 ["m"] = new KeyDefinition1116 {1117 KeyCode = 77,1118 Key = "m",1119 Code = "KeyM"1120 },1121 ["n"] = new KeyDefinition1122 {1123 KeyCode = 78,1124 Key = "n",1125 Code = "KeyN"1126 },1127 ["o"] = new KeyDefinition1128 {1129 KeyCode = 79,1130 Key = "o",1131 Code = "KeyO"1132 },1133 ["p"] = new KeyDefinition1134 {1135 KeyCode = 80,1136 Key = "p",1137 Code = "KeyP"1138 },1139 ["q"] = new KeyDefinition1140 {1141 KeyCode = 81,1142 Key = "q",1143 Code = "KeyQ"1144 },1145 ["r"] = new KeyDefinition1146 {1147 KeyCode = 82,1148 Key = "r",1149 Code = "KeyR"1150 },1151 ["s"] = new KeyDefinition1152 {1153 KeyCode = 83,1154 Key = "s",1155 Code = "KeyS"1156 },1157 ["t"] = new KeyDefinition1158 {1159 KeyCode = 84,1160 Key = "t",1161 Code = "KeyT"1162 },1163 ["u"] = new KeyDefinition1164 {1165 KeyCode = 85,1166 Key = "u",1167 Code = "KeyU"1168 },1169 ["v"] = new KeyDefinition1170 {1171 KeyCode = 86,1172 Key = "v",1173 Code = "KeyV"1174 },1175 ["w"] = new KeyDefinition1176 {1177 KeyCode = 87,1178 Key = "w",1179 Code = "KeyW"1180 },1181 ["x"] = new KeyDefinition1182 {1183 KeyCode = 88,1184 Key = "x",1185 Code = "KeyX"1186 },1187 ["y"] = new KeyDefinition1188 {1189 KeyCode = 89,1190 Key = "y",1191 Code = "KeyY"1192 },1193 ["z"] = new KeyDefinition1194 {1195 KeyCode = 90,1196 Key = "z",1197 Code = "KeyZ"1198 },1199 ["Meta"] = new KeyDefinition1200 {1201 KeyCode = 91,1202 Key = "Meta",1203 Code = "MetaLeft"1204 },1205 ["*"] = new KeyDefinition1206 {1207 KeyCode = 106,1208 Key = "*",1209 Code = "NumpadMultiply",1210 Location = 31211 },1212 ["+"] = new KeyDefinition1213 {1214 KeyCode = 107,1215 Key = "+",1216 Code = "NumpadAdd",1217 Location = 31218 },1219 ["-"] = new KeyDefinition1220 {1221 KeyCode = 109,1222 Key = "-",1223 Code = "NumpadSubtract",1224 Location = 31225 },1226 ["/"] = new KeyDefinition1227 {1228 KeyCode = 111,1229 Key = "/",1230 Code = "NumpadDivide",1231 Location = 31232 },1233 [";"] = new KeyDefinition1234 {1235 KeyCode = 186,1236 Key = ";",1237 Code = "Semicolon"1238 },1239 ["="] = new KeyDefinition1240 {1241 KeyCode = 187,1242 Key = "=",1243 Code = "Equal"1244 },1245 [","] = new KeyDefinition1246 {1247 KeyCode = 188,1248 Key = ",",1249 Code = "Comma"1250 },1251 ["."] = new KeyDefinition1252 {1253 KeyCode = 190,1254 Key = ".",1255 Code = "Period"1256 },1257 ["`"] = new KeyDefinition1258 {1259 KeyCode = 192,1260 Key = "`",1261 Code = "Backquote"1262 },1263 ["["] = new KeyDefinition1264 {1265 KeyCode = 219,1266 Key = "[",1267 Code = "BracketLeft"1268 },1269 ["\\"] = new KeyDefinition1270 {1271 KeyCode = 220,1272 Key = "\\",1273 Code = "Backslash"1274 },1275 ["]"] = new KeyDefinition1276 {1277 KeyCode = 221,1278 Key = "]",1279 Code = "BracketRight"1280 },1281 ["'"] = new KeyDefinition1282 {1283 KeyCode = 222,1284 Key = "'",1285 Code = "Quote"1286 },1287 ["Attn"] = new KeyDefinition1288 {1289 KeyCode = 246,1290 Key = "Attn"1291 },1292 ["CrSel"] = new KeyDefinition1293 {1294 KeyCode = 247,1295 Key = "CrSel",1296 Code = "Props"1297 },1298 ["ExSel"] = new KeyDefinition1299 {1300 KeyCode = 248,1301 Key = "ExSel"1302 },1303 ["EraseEof"] = new KeyDefinition1304 {1305 KeyCode = 249,1306 Key = "EraseEof"1307 },1308 ["Play"] = new KeyDefinition1309 {1310 KeyCode = 250,1311 Key = "Play"1312 },1313 ["ZoomOut"] = new KeyDefinition1314 {1315 KeyCode = 251,1316 Key = "ZoomOut"1317 },1318 [")"] = new KeyDefinition1319 {1320 KeyCode = 48,1321 Key = ")",1322 Code = "Digit0"1323 },1324 ["!"] = new KeyDefinition1325 {1326 KeyCode = 49,1327 Key = "!",1328 Code = "Digit1"1329 },1330 ["@"] = new KeyDefinition1331 {1332 KeyCode = 50,1333 Key = "@",1334 Code = "Digit2"1335 },1336 ["#"] = new KeyDefinition1337 {1338 KeyCode = 51,1339 Key = "#",1340 Code = "Digit3"1341 },1342 ["$"] = new KeyDefinition1343 {1344 KeyCode = 52,1345 Key = "$",1346 Code = "Digit4"1347 },1348 ["%"] = new KeyDefinition1349 {1350 KeyCode = 53,1351 Key = "%",1352 Code = "Digit5"1353 },1354 ["^"] = new KeyDefinition1355 {1356 KeyCode = 54,1357 Key = "^",1358 Code = "Digit6"1359 },1360 ["&"] = new KeyDefinition1361 {1362 KeyCode = 55,1363 Key = "&",1364 Code = "Digit7"1365 },1366 ["("] = new KeyDefinition1367 {1368 KeyCode = 57,1369 Key = "(",1370 Code = "Digit9"1371 },1372 ["A"] = new KeyDefinition1373 {1374 KeyCode = 65,1375 Key = "A",1376 Code = "KeyA"1377 },1378 ["B"] = new KeyDefinition1379 {1380 KeyCode = 66,1381 Key = "B",1382 Code = "KeyB"1383 },1384 ["C"] = new KeyDefinition1385 {1386 KeyCode = 67,1387 Key = "C",1388 Code = "KeyC"1389 },1390 ["D"] = new KeyDefinition1391 {1392 KeyCode = 68,1393 Key = "D",1394 Code = "KeyD"1395 },1396 ["E"] = new KeyDefinition1397 {1398 KeyCode = 69,1399 Key = "E",1400 Code = "KeyE"1401 },1402 ["F"] = new KeyDefinition1403 {1404 KeyCode = 70,1405 Key = "F",1406 Code = "KeyF"1407 },1408 ["G"] = new KeyDefinition1409 {1410 KeyCode = 71,1411 Key = "G",1412 Code = "KeyG"1413 },1414 ["H"] = new KeyDefinition1415 {1416 KeyCode = 72,1417 Key = "H",1418 Code = "KeyH"1419 },1420 ["I"] = new KeyDefinition1421 {1422 KeyCode = 73,1423 Key = "I",1424 Code = "KeyI"1425 },1426 ["J"] = new KeyDefinition1427 {1428 KeyCode = 74,1429 Key = "J",1430 Code = "KeyJ"1431 },1432 ["K"] = new KeyDefinition1433 {1434 KeyCode = 75,1435 Key = "K",1436 Code = "KeyK"1437 },1438 ["L"] = new KeyDefinition1439 {1440 KeyCode = 76,1441 Key = "L",1442 Code = "KeyL"1443 },1444 ["M"] = new KeyDefinition1445 {1446 KeyCode = 77,1447 Key = "M",1448 Code = "KeyM"1449 },1450 ["N"] = new KeyDefinition1451 {1452 KeyCode = 78,1453 Key = "N",1454 Code = "KeyN"1455 },1456 ["O"] = new KeyDefinition1457 {1458 KeyCode = 79,1459 Key = "O",1460 Code = "KeyO"1461 },1462 ["P"] = new KeyDefinition1463 {1464 KeyCode = 80,1465 Key = "P",1466 Code = "KeyP"1467 },1468 ["Q"] = new KeyDefinition1469 {1470 KeyCode = 81,1471 Key = "Q",1472 Code = "KeyQ"1473 },1474 ["R"] = new KeyDefinition1475 {1476 KeyCode = 82,1477 Key = "R",1478 Code = "KeyR"1479 },1480 ["S"] = new KeyDefinition1481 {1482 KeyCode = 83,1483 Key = "S",1484 Code = "KeyS"1485 },1486 ["T"] = new KeyDefinition1487 {1488 KeyCode = 84,1489 Key = "T",1490 Code = "KeyT"1491 },1492 ["U"] = new KeyDefinition1493 {1494 KeyCode = 85,1495 Key = "U",1496 Code = "KeyU"1497 },1498 ["V"] = new KeyDefinition1499 {1500 KeyCode = 86,1501 Key = "V",1502 Code = "KeyV"1503 },1504 ["W"] = new KeyDefinition1505 {1506 KeyCode = 87,1507 Key = "W",1508 Code = "KeyW"1509 },1510 ["X"] = new KeyDefinition1511 {1512 KeyCode = 88,1513 Key = "X",1514 Code = "KeyX"1515 },1516 ["Y"] = new KeyDefinition1517 {1518 KeyCode = 89,1519 Key = "Y",1520 Code = "KeyY"1521 },1522 ["Z"] = new KeyDefinition1523 {1524 KeyCode = 90,1525 Key = "Z",1526 Code = "KeyZ"1527 },1528 [":"] = new KeyDefinition1529 {1530 KeyCode = 186,1531 Key = ":",1532 Code = "Semicolon"1533 },1534 ["<"] = new KeyDefinition1535 {1536 KeyCode = 188,1537 Key = "<",1538 Code = "Comma"1539 },1540 ["_"] = new KeyDefinition1541 {1542 KeyCode = 189,1543 Key = "_",1544 Code = "Minus"1545 },1546 [">"] = new KeyDefinition1547 {1548 KeyCode = 190,1549 Key = ">",1550 Code = "Period"1551 },1552 ["?"] = new KeyDefinition1553 {1554 KeyCode = 191,1555 Key = "?",1556 Code = "Slash"1557 },1558 ["~"] = new KeyDefinition1559 {1560 KeyCode = 192,1561 Key = "~",1562 Code = "Backquote"1563 },1564 ["{"] = new KeyDefinition1565 {1566 KeyCode = 219,1567 Key = "{",1568 Code = "BracketLeft"1569 },1570 ["|"] = new KeyDefinition1571 {1572 KeyCode = 220,1573 Key = "|",1574 Code = "Backslash"1575 },1576 ["}"] = new KeyDefinition1577 {1578 KeyCode = 221,1579 Key = "}",1580 Code = "BracketRight"1581 },1582 ["\""] = new KeyDefinition1583 {1584 KeyCode = 222,1585 Key = "\"",1586 Code = "Quote"1587 },1588 };1589 internal static KeyDefinition Get(string key) => Definitions[key];1590 1591 internal static bool ContainsKey(string key) => Definitions.ContainsKey(key);1592 }1593}...
Keyboard.cs
Source:Keyboard.cs
...20 }21 /// <summary>22 /// Dispatches a <c>keydown</c> event23 /// </summary>24 /// <param name="key">Name of key to press, such as <c>ArrowLeft</c>. <see cref="KeyDefinitions"/> for a list of all key names.</param>25 /// <param name="options">down options</param>26 /// <remarks>27 /// If <c>key</c> is a single character and no modifier keys besides <c>Shift</c> are being held down, a <c>keypress</c>/<c>input</c> event will also generated. The <c>text</c> option can be specified to force an input event to be generated.28 /// If <c>key</c> is a modifier key, <c>Shift</c>, <c>Meta</c>, <c>Control</c>, or <c>Alt</c>, subsequent key presses will be sent with that modifier active. To release the modifier key, use <see cref="UpAsync(string)"/>29 /// After the key is pressed once, subsequent calls to <see cref="DownAsync(string, DownOptions)"/> will have <see href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat">repeat</see> set to <c>true</c>. To release the key, use <see cref="UpAsync(string)"/>30 /// </remarks>31 /// <returns>Task</returns>32 public Task DownAsync(string key, DownOptions options = null)33 {34 var description = KeyDescriptionForString(key);35 var autoRepeat = _pressedKeys.Contains(description.Code);36 _pressedKeys.Add(description.Code);37 Modifiers |= ModifierBit(key);38 var text = options?.Text == null ? description.Text : options.Text;39 return _client.SendAsync("Input.dispatchKeyEvent", new Dictionary<string, object>40 {41 { MessageKeys.Type, text != null ? "keyDown" : "rawKeyDown" },42 { MessageKeys.Modifiers, Modifiers },43 { MessageKeys.WindowsVirtualKeyCode, description.KeyCode },44 { MessageKeys.Code, description.Code },45 { MessageKeys.Key, description.Key },46 { MessageKeys.Text, text },47 { MessageKeys.UnmodifiedText, text },48 { MessageKeys.AutoRepeat, autoRepeat },49 { MessageKeys.Location, description.Location },50 { MessageKeys.IsKeypad, description.Location == 3 }51 });52 }53 /// <summary>54 /// Dispatches a <c>keyup</c> event.55 /// </summary>56 /// <param name="key">Name of key to release, such as `ArrowLeft`. See <see cref="KeyDefinitions"/> for a list of all key names.</param>57 /// <returns>Task</returns>58 public Task UpAsync(string key)59 {60 var description = KeyDescriptionForString(key);61 Modifiers &= ~ModifierBit(key);62 _pressedKeys.Remove(description.Code);63 return _client.SendAsync("Input.dispatchKeyEvent", new Dictionary<string, object>64 {65 { MessageKeys.Type, "keyUp" },66 { MessageKeys.Modifiers, Modifiers },67 { MessageKeys.Key, description.Key },68 { MessageKeys.WindowsVirtualKeyCode, description.KeyCode },69 { MessageKeys.Code, description.Code },70 { MessageKeys.Location, description.Location }71 });72 }73 /// <summary>74 /// Dispatches a <c>keypress</c> and <c>input</c> event. This does not send a <c>keydown</c> or <c>keyup</c> event.75 /// </summary>76 /// <param name="charText">Character to send into the page</param>77 /// <returns>Task</returns>78 public Task SendCharacterAsync(string charText)79 => _client.SendAsync("Input.insertText", new Dictionary<string, object> { [MessageKeys.Text] = charText });80 /// <summary>81 /// Sends a <c>keydown</c>, <c>keypress</c>/<c>input</c>, and <c>keyup</c> event for each character in the text.82 /// </summary>83 /// <param name="text">A text to type into a focused element</param>84 /// <param name="options">type options</param>85 /// <remarks>86 /// To press a special key, like <c>Control</c> or <c>ArrowDown</c>, use <see cref="PressAsync(string, PressOptions)"/>87 /// </remarks>88 /// <returns>Task</returns>89 public async Task TypeAsync(string text, TypeOptions options = null)90 {91 var delay = 0;92 if (options?.Delay != null)93 {94 delay = (int)options.Delay;95 }96 var textParts = StringInfo.GetTextElementEnumerator(text);97 while (textParts.MoveNext())98 {99 var letter = textParts.Current;100 if (KeyDefinitions.ContainsKey(letter.ToString()))101 {102 await PressAsync(letter.ToString(), new PressOptions { Delay = delay }).ConfigureAwait(false);103 }104 else105 {106 await SendCharacterAsync(letter.ToString()).ConfigureAwait(false);107 }108 if (delay > 0)109 {110 await Task.Delay(delay).ConfigureAwait(false);111 }112 }113 }114 /// <summary>115 /// Shortcut for <see cref="DownAsync(string, DownOptions)"/> and <see cref="UpAsync(string)"/>116 /// </summary>117 /// <param name="key">Name of key to press, such as <c>ArrowLeft</c>. <see cref="KeyDefinitions"/> for a list of all key names.</param>118 /// <param name="options">press options</param>119 /// <remarks>120 /// If <paramref name="key"/> is a single character and no modifier keys besides <c>Shift</c> are being held down, a <c>keypress</c>/<c>input</c> event will also generated. The <see cref="DownOptions.Text"/> option can be specified to force an input event to be generated.121 /// Modifier keys DO effect <see cref="ElementHandle.PressAsync(string, PressOptions)"/>. Holding down <c>Shift</c> will type the text in upper case.122 /// </remarks>123 /// <returns>Task</returns>124 public async Task PressAsync(string key, PressOptions options = null)125 {126 await DownAsync(key, options).ConfigureAwait(false);127 if (options?.Delay > 0)128 {129 await Task.Delay((int)options.Delay).ConfigureAwait(false);130 }131 await UpAsync(key).ConfigureAwait(false);132 }133 private int ModifierBit(string key)134 {135 if (key == "Alt")136 {137 return 1;138 }139 if (key == "Control")140 {141 return 2;142 }143 if (key == "Meta")144 {145 return 4;146 }147 if (key == "Shift")148 {149 return 8;150 }151 return 0;152 }153 private KeyDefinition KeyDescriptionForString(string keyString)154 {155 var shift = Modifiers & 8;156 var description = new KeyDefinition157 {158 Key = string.Empty,159 KeyCode = 0,160 Code = string.Empty,161 Text = string.Empty,162 Location = 0163 };164 var definition = KeyDefinitions.Get(keyString);165 if (!string.IsNullOrEmpty(definition.Key))166 {167 description.Key = definition.Key;168 }169 if (shift > 0 && !string.IsNullOrEmpty(definition.ShiftKey))170 {171 description.Key = definition.ShiftKey;172 }173 if (definition.KeyCode > 0)174 {175 description.KeyCode = definition.KeyCode;176 }177 if (shift > 0 && definition.ShiftKeyCode != null)178 {...
KeyDefinition.cs
Source:KeyDefinition.cs
1namespace PuppeteerSharp.Input2{3 internal class KeyDefinition4 {5 internal int KeyCode { get; set; }6 internal int? ShiftKeyCode { get; set; }7 internal string Key { get; set; }8 internal string ShiftKey { get; set; }9 internal string Code { get; set; }10 internal string Text { get; set; }11 internal string ShiftText { get; set; }12 internal int Location { get; set; }13 }14}...
KeyDefinition
Using AI Code Generation
1using PuppeteerSharp.Input;2using System;3using System.Collections.Generic;4using System.Linq;5using System.Text;6using System.Threading.Tasks;7{8 {9 public string Key { get; set; }10 public string Code { get; set; }11 public string Text { get; set; }12 public int Location { get; set; }13 }14}15using PuppeteerSharp.Input;16using System;17using System.Collections.Generic;18using System.Linq;19using System.Text;20using System.Threading.Tasks;21{22 {23 public string Key { get; set; }24 public string Code { get; set; }25 public string Text { get; set; }26 public int Location { get; set; }27 }28}29using PuppeteerSharp.Input;30using System;31using System.Collections.Generic;32using System.Linq;33using System.Text;34using System.Threading.Tasks;35{36 {37 public string Key { get; set; }38 public string Code { get; set; }39 public string Text { get; set; }40 public int Location { get; set; }41 }42}43using PuppeteerSharp.Input;44using System;45using System.Collections.Generic;46using System.Linq;47using System.Text;48using System.Threading.Tasks;49{50 {51 public string Key { get; set; }52 public string Code { get; set; }53 public string Text { get; set; }54 public int Location { get; set; }55 }56}57using PuppeteerSharp.Input;58using System;59using System.Collections.Generic;60using System.Linq;61using System.Text;62using System.Threading.Tasks;63{64 {65 public string Key { get; set; }66 public string Code { get; set; }67 public string Text { get; set; }
KeyDefinition
Using AI Code Generation
1using PuppeteerSharp.Input;2using PuppeteerSharp.Input;3using PuppeteerSharp.Input;4using PuppeteerSharp.Input;5using PuppeteerSharp.Input;6using PuppeteerSharp.Input;7using PuppeteerSharp.Input;8using PuppeteerSharp.Input;9using PuppeteerSharp.Input;10using PuppeteerSharp.Input;11using PuppeteerSharp.Input;12using PuppeteerSharp.Input;13using PuppeteerSharp.Input;14using PuppeteerSharp.Input;15using PuppeteerSharp.Input;
KeyDefinition
Using AI Code Generation
1using PuppeteerSharp.Input;2using PuppeteerSharp.Input;3using PuppeteerSharp.Input;4using PuppeteerSharp.Input;5using PuppeteerSharp.Input;6using PuppeteerSharp.Input;7using PuppeteerSharp.Input;8using PuppeteerSharp.Input;9using PuppeteerSharp.Input;10using PuppeteerSharp.Input;11using PuppeteerSharp.Input;12using PuppeteerSharp.Input;13using PuppeteerSharp.Input;14using PuppeteerSharp.Input;
KeyDefinition
Using AI Code Generation
1using PuppeteerSharp.Input;2using System.Threading.Tasks;3{4 {5 public static async Task Run()6 {7 using (var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false }))8 {9 var page = await browser.NewPageAsync();10 await page.FocusAsync("input[name='q']");11 await page.Keyboard.TypeAsync("PuppeteerSharp");12 await page.Keyboard.PressAsync("Enter");13 }14 }15 }16}17using PuppeteerSharp.Input;18using System.Threading.Tasks;19{20 {21 public static async Task Run()22 {23 using (var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false }))24 {25 var page = await browser.NewPageAsync();26 await page.FocusAsync("input[name='q']");27 await page.Keyboard.TypeAsync("PuppeteerSharp");28 await page.Keyboard.PressAsync("Enter");29 }30 }31 }32}33using PuppeteerSharp.Input;34using System.Threading.Tasks;35{36 {37 public static async Task Run()38 {39 using (var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false }))40 {41 var page = await browser.NewPageAsync();42 await page.FocusAsync("input[name='q']");43 await page.Keyboard.TypeAsync("PuppeteerSharp");44 await page.Keyboard.PressAsync("Enter");45 }46 }47 }48}49using PuppeteerSharp.Input;50using System.Threading.Tasks;51{52 {53 public static async Task Run()54 {55 using (var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false }))56 {
KeyDefinition
Using AI Code Generation
1var key = new KeyDefinition("F1");2await page.Keyboard.DownAsync(key);3await page.Keyboard.UpAsync(key);4var key = new KeyDefinition("F1");5await page.Keyboard.DownAsync(key);6await page.Keyboard.UpAsync(key);7var key = new KeyDefinition("F1");8await page.Keyboard.DownAsync(key);9await page.Keyboard.UpAsync(key);10var key = new KeyDefinition("F1");11await page.Keyboard.DownAsync(key);12await page.Keyboard.UpAsync(key);13var key = new KeyDefinition("F1");14await page.Keyboard.DownAsync(key);15await page.Keyboard.UpAsync(key);16var key = new KeyDefinition("F1");17await page.Keyboard.DownAsync(key);18await page.Keyboard.UpAsync(key);19var key = new KeyDefinition("F1");20await page.Keyboard.DownAsync(key);21await page.Keyboard.UpAsync(key);22var key = new KeyDefinition("F1");23await page.Keyboard.DownAsync(key);24await page.Keyboard.UpAsync(key);25var key = new KeyDefinition("F1");26await page.Keyboard.DownAsync(key);27await page.Keyboard.UpAsync(key);28var key = new KeyDefinition("F1");29await page.Keyboard.DownAsync(key);30await page.Keyboard.UpAsync(key);31var key = new KeyDefinition("F1");32await page.Keyboard.DownAsync(key);33await page.Keyboard.UpAsync(key);
KeyDefinition
Using AI Code Generation
1var keyDef = new KeyDefinition("ControlLeft");2await page.Keyboard.PressAsync(keyDef);3var keyDef = new KeyDefinition("ControlLeft");4await page.Keyboard.PressAsync(keyDef);5var keyDef = new KeyDefinition("ControlLeft");6await page.Keyboard.PressAsync(keyDef);7var keyDef = new KeyDefinition("ControlLeft");8await page.Keyboard.PressAsync(keyDef);9var keyDef = new KeyDefinition("ControlLeft");10await page.Keyboard.PressAsync(keyDef);11var keyDef = new KeyDefinition("ControlLeft");12await page.Keyboard.PressAsync(keyDef);13var keyDef = new KeyDefinition("ControlLeft");14await page.Keyboard.PressAsync(keyDef);15var keyDef = new KeyDefinition("ControlLeft");16await page.Keyboard.PressAsync(keyDef);17var keyDef = new KeyDefinition("ControlLeft");18await page.Keyboard.PressAsync(keyDef);19var keyDef = new KeyDefinition("ControlLeft");20await page.Keyboard.PressAsync(keyDef);21var keyDef = new KeyDefinition("ControlLeft");22await page.Keyboard.PressAsync(keyDef);23var keyDef = new KeyDefinition("ControlLeft");24await page.Keyboard.PressAsync(keyDef);
KeyDefinition
Using AI Code Generation
1using PuppeteerSharp;2using System;3using System.Threading.Tasks;4using System.Threading;5{6 {7 public static async Task Main(string[] args)8 {9 var browser = await Puppeteer.LaunchAsync(new LaunchOptions10 {11 });12 var page = await browser.NewPageAsync();13 await page.TypeAsync("input[name=q]", "Hello World");14 await page.Keyboard.PressAsync("Enter");15 await page.WaitForSelectorAsync("h3");16 await page.ScreenshotAsync("screenshot.png");17 await browser.CloseAsync();18 }19 }20}21using PuppeteerSharp;22using System;23using System.Threading.Tasks;24using System.Threading;25{26 {27 public static async Task Main(string[] args)28 {29 var browser = await Puppeteer.LaunchAsync(new LaunchOptions30 {31 });32 var page = await browser.NewPageAsync();33 await page.TypeAsync("input[name=q]", "Hello World");34 await page.Keyboard.PressAsync("Enter");35 await page.WaitForSelectorAsync("h3");36 await page.ScreenshotAsync("screenshot.png");37 await browser.CloseAsync();38 }39 }40}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!