FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-webdriver/PHPWebDriver/WebDriverElement.php at master · drupalmind/php-webdriver · GitHub
drupalmind
/
php-webdriver
Public
forked from
Element-34/php-webdriver
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
php-webdriver
/
PHPWebDriver
/
WebDriverElement.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
84 lines (74 loc) · 2.61 KB
Breadcrumbs
php-webdriver
/
PHPWebDriver
/
WebDriverElement.php
Copy path
File metadata and controls
84 lines (74 loc) · 2.61 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
<?php
// Copyright 2004-present Facebook. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
final
class
PHPWebDriver_WebDriverElement
extends
PHPWebDriver_WebDriverContainer {
protected
function
methods
() {
return
array
(
'
active
'
=>
'
POST
'
,
'
click
'
=>
'
POST
'
,
'
submit
'
=>
'
POST
'
,
'
text
'
=>
'
GET
'
,
'
value
'
=>
'
POST
'
,
'
name
'
=>
'
GET
'
,
'
clear
'
=>
'
POST
'
,
'
selected
'
=>
'
GET
'
,
'
enabled
'
=>
'
GET
'
,
'
attribute
'
=>
'
GET
'
,
'
equals
'
=>
'
GET
'
,
'
displayed
'
=>
'
GET
'
,
'
location
'
=>
'
GET
'
,
'
location_in_view
'
=>
'
GET
'
,
'
size
'
=>
'
GET
'
,
'
css
'
=>
'
GET
'
,
);
}
private
$
id
;
public
function
__construct
(
$
url
,
$
id
,
$
session
) {
$
this
->
id
=
$
id
;
parent
::
__construct
(
$
url
);
$
this
->
session
=
$
session
;
}
public
function
getID
() {
return
$
this
->
id
;
}
protected
function
getElementPath
(
$
element_id
) {
return
preg_replace
(
sprintf
(
'
/%s$/
'
,
$
this
->
id
),
$
element_id
,
$
this
->
url
);
}
public
function
sendKeys
(
$
keys
) {
if
(
file_exists
(
$
keys
)) {
// get a new random name for our zip -- why php://memory doesn't work is a mystery and a pain
// ok, i know why, but definitly a pain
$
filename
=
tempnam
(
sys_get_temp_dir
(),
'
wd-
'
);
// make a zip of the file we want to send to the remote server
$
zip
=
new
ZipArchive
();
$
code_open
=
$
zip
->
open
(
$
filename
,
ZIPARCHIVE
::
OVERWRITE
);
if
(
$
code_open
===
True
) {
// without the basename() it adds the paths in the zip which doesn't work so well
$
code_add
=
$
zip
->
addFile
(
$
keys
,
basename
(
$
keys
));
$
zip
->
close
();
}
// base64 the zip
$
contents
=
fread
(
fopen
(
$
filename
,
'
r+b
'
),
filesize
(
$
filename
));
$
encoded
=
base64_encode
(
$
contents
);
// the response from the upload is the path on the remote server
$
upload_result
=
$
this
->
session
->
file
(
array
(
'
file
'
=>
$
encoded
));
// so act like it was always thus
$
keys
=
$
upload_result
;
// oh, and cleanup
unlink
(
$
filename
);
}
$
results
=
$
this
->
value
(
array
(
"
value
"
=>
array
(
$
keys
)));
return
$
results
;
}
}
Back
|
FazBrowse Home
|
New Git URL