webkit_remote 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/webkit_remote/client/dom.rb +6 -3
- data/test/webkit_remote/client/dom_test.rb +18 -9
- data/webkit_remote.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb9d8b3286536660ca3d24fa8a141624cf481ac7
|
4
|
+
data.tar.gz: 230b9d1de0ac94e75371b5b70008d34a0f314827
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f81789922130b6afaff41745a2476c9d6dc724cec3f0c9c2159f828598a2ee4ad0af1f513f259c3bb66b21ee0e7bdc6ca02829049afbd0915b8034b9184ae6b
|
7
|
+
data.tar.gz: 9c28a1f6f474f6e0992629e1d15e67f204e9891770f9a32fda629b2e555c00dd37b77c7b93217afd37f68c66759ac9a3ca3ecbae92b6277c9247c420722dcd4b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
@@ -28,7 +28,7 @@ module Dom
|
|
28
28
|
|
29
29
|
# Looks up cached information about a DOM node.
|
30
30
|
#
|
31
|
-
# @private Use WebkitRemote::Client::Dom#
|
31
|
+
# @private Use WebkitRemote::Client::Dom#query_selector or the other public
|
32
32
|
# APIs instead of calling this directly
|
33
33
|
#
|
34
34
|
# @param [String] remote_id value of the nodeId attribute in the JSON
|
@@ -139,11 +139,14 @@ class DomNode
|
|
139
139
|
#
|
140
140
|
# @param [String] css_selector the CSS selector that must be matched by the
|
141
141
|
# returned node
|
142
|
-
# @return [WebkitRemote::Client::DomNode] DOM
|
143
|
-
# that
|
142
|
+
# @return [WebkitRemote::Client::DomNode] the first DOM node in this node's
|
143
|
+
# subtree that matches the given selector; if no such node exists, nil is
|
144
|
+
# returned
|
144
145
|
def query_selector(css_selector)
|
145
146
|
result = @client.rpc.call 'DOM.querySelector', nodeId: @remote_id,
|
146
147
|
selector: css_selector
|
148
|
+
node_id = result['nodeId']
|
149
|
+
return nil if node_id == 0
|
147
150
|
@client.dom_node result['nodeId']
|
148
151
|
end
|
149
152
|
|
@@ -38,18 +38,27 @@ describe WebkitRemote::Client::DomNode do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe 'querySelector' do
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
describe 'with a selector that matches' do
|
42
|
+
before :all do
|
43
|
+
@p = @root.query_selector 'p#load-confirmation'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns a WebkitRemote::Client::DomNode' do
|
47
|
+
@p.must_be_kind_of WebkitRemote::Client::DomNode
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
50
|
+
it 'returns a WebkitRemote::Client::DomNode with correct attributes' do
|
51
|
+
skip 'On-demand node processing not implemented'
|
52
|
+
@p.node_type.must_equal :element
|
53
|
+
@p.name.must_equal 'P'
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
57
|
+
describe 'with a selector that does not match' do
|
58
|
+
it 'returns nil' do
|
59
|
+
node = @root.query_selector '#this-id-should-not-exist'
|
60
|
+
node.must_equal nil
|
61
|
+
end
|
53
62
|
end
|
54
63
|
end
|
55
64
|
|
data/webkit_remote.gemspec
CHANGED