-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomsleep.java
More file actions
121 lines (92 loc) · 4.29 KB
/
Randomsleep.java
File metadata and controls
121 lines (92 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package botpackage;
import java.util.Date;
import java.util.Random;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
public class Randomsleep {
// WebDriver driver;
// WebDriverWait wait = new WebDriverWait(driver,120);
//heure /date
private void date() {
Date maDate = new Date();
//affichage:
System.out.println(maDate.toString());
}
//classic
private static final int MIN_VALUE1 = 2000;
private static final int MAX_VALUE1 = 10000;
public void classic()
{
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE1 - MIN_VALUE1) + MIN_VALUE1;
System.out.println("[Attente :" + myRandomNumber+"]");
try { Thread.sleep(myRandomNumber);} catch (Exception e){e.printStackTrace();}
}
//trescourt
private static final int MIN_VALUE5 = 600;
private static final int MAX_VALUE5 = 814;
public void tcourt()
{
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE5 - MIN_VALUE5) + MIN_VALUE5;
System.out.println("[Attente : " + myRandomNumber+ "]");
try { Thread.sleep(myRandomNumber);} catch (Exception e){e.printStackTrace();}
}
//court
private static final int MIN_VALUE2 = 1000;
private static final int MAX_VALUE2 = 3000;
public boolean court()
{
//wait.until(ExpectedConditions.elementToBeClickable(By.className("button-content")));
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE2 - MIN_VALUE2) + MIN_VALUE2;
System.out.println("[Attente : " + myRandomNumber+"]");
try { Thread.sleep(myRandomNumber);} catch (InterruptedException e){System.out.println("Pause annulee");return true;}
return false;
}
//lent
private static final int MIN_VALUE3 = 60000*4;
private static final int MAX_VALUE3 = 60000*11;
public void lent()
{
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE3 - MIN_VALUE3) + MIN_VALUE3;
date();
System.out.println("Attente de : " + myRandomNumber/1000/60 +"minutes " + (myRandomNumber/1000-(myRandomNumber/1000/60)*60) + "sec. et le chiffre de base en milliseconde " +myRandomNumber);
try { Thread.sleep(myRandomNumber);} catch (Exception e){e.printStackTrace();}
}
//treslent
private static final int MIN_VALUE4 = 1500000;
private static final int MAX_VALUE4 = 3000000;
public void treslent()
{
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE4 - MIN_VALUE4) + MIN_VALUE4;
date();
System.out.println("Attente :" + myRandomNumber/1000/60 +"minutes " + (myRandomNumber/1000-(myRandomNumber/1000/60)*60) + "sec. et le chiffre de base en milliseconde " +myRandomNumber);
try { Thread.sleep(myRandomNumber);} catch (Exception e){e.printStackTrace();}
}
//Special
//classic
private static final int MIN_VALUE6 = 6000;
private static final int MAX_VALUE6 = 10000;
public void specialclassic()
{
Random random = new Random();
int myRandomNumber = random.nextInt(MAX_VALUE1 - MIN_VALUE1) + MIN_VALUE1;
System.out.println("[Attente :" + myRandomNumber+"]");
try { Thread.sleep(myRandomNumber);} catch (Exception e){e.printStackTrace();}
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
}