This commit is contained in:
parent
2d9a51d74a
commit
e456fa5bda
4 changed files with 12 additions and 12 deletions
|
@ -24,7 +24,7 @@ let rec check ctx =
|
|||
Unix.sleep timeout;
|
||||
if ctx.debug then print_endline "Refresh profile page...";
|
||||
refresh_page ctx.session_id;
|
||||
Unix.sleep 4;
|
||||
Unix.sleep 8;
|
||||
check ctx
|
||||
in
|
||||
(* Time to wait until next check *)
|
||||
|
|
|
@ -19,9 +19,9 @@ let inject_username session_id creds =
|
|||
in
|
||||
(* Insert the username *)
|
||||
send_keys session_id input_username creds.username;
|
||||
Unix.sleep 1;
|
||||
Unix.sleep 2;
|
||||
send_keys session_id input_username Keys.return;
|
||||
Unix.sleep 3
|
||||
Unix.sleep 6
|
||||
;;
|
||||
|
||||
let rec _inject_password session_id creds try_count =
|
||||
|
@ -47,9 +47,9 @@ let rec _inject_password session_id creds try_count =
|
|||
| Some input ->
|
||||
(* Insert password *)
|
||||
send_keys session_id input creds.password;
|
||||
Unix.sleep 1;
|
||||
Unix.sleep 2;
|
||||
send_keys session_id input Keys.return;
|
||||
Unix.sleep 3
|
||||
Unix.sleep 6
|
||||
| None -> ()
|
||||
;;
|
||||
|
||||
|
@ -63,9 +63,9 @@ let inject_2fa session_id secret input =
|
|||
in
|
||||
(* Insert 2FA code *)
|
||||
send_keys session_id input code;
|
||||
Unix.sleep 1;
|
||||
Unix.sleep 2;
|
||||
send_keys session_id input Keys.return;
|
||||
Unix.sleep 5
|
||||
Unix.sleep 10
|
||||
;;
|
||||
|
||||
let login_twitter ctx username password secret =
|
||||
|
@ -108,7 +108,7 @@ let go_to_profile ctx =
|
|||
(fmt
|
||||
"https://twitter.com%s/with_replies"
|
||||
(get_attribute ctx.session_id profile_button "href")));
|
||||
Unix.sleep 4
|
||||
Unix.sleep 8
|
||||
;;
|
||||
|
||||
let find_latest_tweet ctx =
|
||||
|
@ -160,7 +160,7 @@ let tweet ctx msg =
|
|||
else List.nth l 0
|
||||
in
|
||||
send_keys ctx.session_id tweet_area msg;
|
||||
Unix.sleep 1;
|
||||
Unix.sleep 2;
|
||||
let send_tweet_button =
|
||||
match find ctx.session_id (XPath "//div[@data-testid='tweetButton']") with
|
||||
| [] -> raise (Any (fmt "Send-tweet button not found"))
|
||||
|
@ -170,5 +170,5 @@ let tweet ctx msg =
|
|||
else List.nth l 0
|
||||
in
|
||||
click ctx.session_id send_tweet_button;
|
||||
Unix.sleep 4
|
||||
Unix.sleep 8
|
||||
;;
|
||||
|
|
|
@ -66,7 +66,7 @@ let run_process path args =
|
|||
let pid =
|
||||
Unix.create_process command (Array.of_list args) output_fd output_fd output_fd
|
||||
in
|
||||
Unix.sleepf 0.5;
|
||||
Unix.sleep 1;
|
||||
out_channel, pid
|
||||
;;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ let rec wait_for_load session_id =
|
|||
| `String res ->
|
||||
if not (res = "complete")
|
||||
then (
|
||||
Unix.sleep 1;
|
||||
Unix.sleep 2;
|
||||
wait_for_load session_id)
|
||||
| _ -> raise (Any "Error when waiting for page to load"))
|
||||
| _ -> raise (Any "wait_for_load | Invalid JSON")
|
||||
|
|
Loading…
Reference in a new issue