ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-WebDriver/WebDriver.pm
(Generate patch)

Comparing AnyEvent-WebDriver/WebDriver.pm (file contents):
Revision 1.28 by root, Fri Aug 31 22:06:17 2018 UTC vs.
Revision 1.29 by root, Sat Sep 1 01:39:17 2018 UTC

955 $wd->navigate_to ("https://duckduckgo.com/html"); 955 $wd->navigate_to ("https://duckduckgo.com/html");
956 my $input = $wd->find_element ("css selector", 'input[type="text"]'); 956 my $input = $wd->find_element ("css selector", 'input[type="text"]');
957 $wd->actions 957 $wd->actions
958 ->move ($input, 40, 5, "touch1") 958 ->move ($input, 40, 5, "touch1")
959 ->click 959 ->click
960 ->pause # to separate the click from the keypress
960 ->key ("a") 961 ->key ("a")
961 ->key ("b") 962 ->key ("b")
962 ->pause (2000) 963 ->pause (2000) # so you can watch leisurely
963 ->key ("\x{E007}") 964 ->key ("{Enter}")
964 ->pause (5000) 965 ->pause (5000) # so you can see the result
965 ->perform; 966 ->perform;
966 967
967=item $wd->release_actions 968=item $wd->release_actions
968 969
969Release all keys and pointer buttons currently depressed. 970Release all keys and pointer buttons currently depressed.
1084For example, to simulate a mouse click to an input element, followed by 1085For example, to simulate a mouse click to an input element, followed by
1085entering some text and pressing enter, you can use this: 1086entering some text and pressing enter, you can use this:
1086 1087
1087 $wd->actions 1088 $wd->actions
1088 ->click (1, 100) 1089 ->click (1, 100)
1090 ->pause # to separate the click from keypressed
1089 ->type ("some text") 1091 ->type ("some text")
1090 ->key ("{Enter}") 1092 ->key ("{Enter}")
1091 ->perform; 1093 ->perform;
1092 1094
1093By default, keyboard and mouse input sources are provided. You can create 1095By default, keyboard and mouse input sources are provided. You can create
1096 1098
1097 $wd->actions 1099 $wd->actions
1098 ->source ("mouse", "pointer", pointerType => "mouse") 1100 ->source ("mouse", "pointer", pointerType => "mouse")
1099 ->source ("kbd", "key") 1101 ->source ("kbd", "key")
1100 ->click (1, 100, "mouse") 1102 ->click (1, 100, "mouse")
1103 ->pause
1101 ->type ("some text", "kbd") 1104 ->type ("some text", "kbd")
1102 ->key ("{Enter}", "kbd") 1105 ->key ("{Enter}", "kbd")
1103 ->perform; 1106 ->perform;
1104 1107
1105When you specify the event source explicitly it will switch the current 1108When you specify the event source explicitly it will switch the current

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines