FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-webdriver/lib/WebDriverTimeouts.php at main · imanrep/php-webdriver · GitHub
imanrep
/
php-webdriver
Public
forked from
php-webdriver/php-webdriver
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-webdriver
/
lib
/
WebDriverTimeouts.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
102 lines (86 loc) · 2.5 KB
Breadcrumbs
php-webdriver
/
lib
/
WebDriverTimeouts.php
Copy path
File metadata and controls
102 lines (86 loc) · 2.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
namespace
Facebook
\
WebDriver
;
use
Facebook
\
WebDriver
\
Remote
\
DriverCommand
;
use
Facebook
\
WebDriver
\
Remote
\
ExecuteMethod
;
/**
* Managing timeout behavior for WebDriver instances.
*/
class
WebDriverTimeouts
{
/**
* @var ExecuteMethod
*/
protected
$
executor
;
/**
* @var bool
*/
protected
$
isW3cCompliant
;
public
function
__construct
(
ExecuteMethod
$
executor
,
$
isW3cCompliant
=
false
)
{
$
this
->
executor
=
$
executor
;
$
this
->
isW3cCompliant
=
$
isW3cCompliant
;
}
/**
* Specify the amount of time the driver should wait when searching for an element if it is not immediately present.
*
* @param int $seconds Wait time in second.
* @return WebDriverTimeouts The current instance.
*/
public
function
implicitlyWait
(
$
seconds
)
{
if
(
$
this
->
isW3cCompliant
) {
$
this
->
executor
->
execute
(
DriverCommand::
IMPLICITLY_WAIT
,
[
'
implicit
'
=>
$
seconds
*
1000
]
);
return
$
this
;
}
$
this
->
executor
->
execute
(
DriverCommand::
IMPLICITLY_WAIT
,
[
'
ms
'
=>
$
seconds
*
1000
]
);
return
$
this
;
}
/**
* Set the amount of time to wait for an asynchronous script to finish execution before throwing an error.
*
* @param int $seconds Wait time in second.
* @return WebDriverTimeouts The current instance.
*/
public
function
setScriptTimeout
(
$
seconds
)
{
if
(
$
this
->
isW3cCompliant
) {
$
this
->
executor
->
execute
(
DriverCommand::
SET_SCRIPT_TIMEOUT
,
[
'
script
'
=>
$
seconds
*
1000
]
);
return
$
this
;
}
$
this
->
executor
->
execute
(
DriverCommand::
SET_SCRIPT_TIMEOUT
,
[
'
ms
'
=>
$
seconds
*
1000
]
);
return
$
this
;
}
/**
* Set the amount of time to wait for a page load to complete before throwing an error.
*
* @param int $seconds Wait time in second.
* @return WebDriverTimeouts The current instance.
*/
public
function
pageLoadTimeout
(
$
seconds
)
{
if
(
$
this
->
isW3cCompliant
) {
$
this
->
executor
->
execute
(
DriverCommand::
SET_SCRIPT_TIMEOUT
,
[
'
pageLoad
'
=>
$
seconds
*
1000
]
);
return
$
this
;
}
$
this
->
executor
->
execute
(DriverCommand::
SET_TIMEOUT
, [
'
type
'
=>
'
page load
'
,
'
ms
'
=>
$
seconds
*
1000
,
]);
return
$
this
;
}
}
Back
|
FazBrowse Home
|
New Git URL