selenium-webdriver 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.js +7 -7
- data/chrome/src/extension/content_script.js +1 -1
- data/chrome/src/extension/utils.js +3 -0
- data/common/src/rb/lib/selenium/webdriver/target_locator.rb +8 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +2 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb +16 -10
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +34 -30
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profiles_ini.rb +12 -13
- data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
- metadata +2 -2
Binary file
|
@@ -424,7 +424,7 @@ function parseRequest(request) {
|
|
424
424
|
var len = ChromeDriver.tabs.length;
|
425
425
|
for (var i = 0; i < len; i++) {
|
426
426
|
if (ChromeDriver.tabs[i].selected) {
|
427
|
-
sendResponseToParsedRequest({statusCode: 0, value: ChromeDriver.tabs[i].
|
427
|
+
sendResponseToParsedRequest({statusCode: 0, value: ChromeDriver.tabs[i].windowName}, false);
|
428
428
|
}
|
429
429
|
}
|
430
430
|
|
@@ -434,7 +434,7 @@ function parseRequest(request) {
|
|
434
434
|
var len = ChromeDriver.tabs.length;
|
435
435
|
for (var i = 0; i < len; i++) {
|
436
436
|
if (ChromeDriver.tabs[i].tabId == tab.id) {
|
437
|
-
sendResponseToParsedRequest({statusCode: 0, value: ChromeDriver.tabs[i].
|
437
|
+
sendResponseToParsedRequest({statusCode: 0, value: ChromeDriver.tabs[i].windowName}, false);
|
438
438
|
return;
|
439
439
|
}
|
440
440
|
}
|
@@ -442,7 +442,7 @@ function parseRequest(request) {
|
|
442
442
|
});
|
443
443
|
} else {
|
444
444
|
// Wow. I can't see this being error prone in the slightest
|
445
|
-
var handle = ChromeDriver.activePort.sender.tab.id;
|
445
|
+
var handle = ChromeDriver.windowHandlePrefix + "_" + ChromeDriver.activePort.sender.tab.id;
|
446
446
|
sendResponseToParsedRequest({statusCode: 0, value: handle}, false);
|
447
447
|
};
|
448
448
|
break;
|
@@ -575,7 +575,7 @@ function parsePortMessage(message) {
|
|
575
575
|
"Received response from content script: " + JSON.stringify(message));
|
576
576
|
if (!message || !message.response || !message.response.value ||
|
577
577
|
message.response.value.statusCode === undefined ||
|
578
|
-
message.response.value.statusCode
|
578
|
+
message.response.value.statusCode === null ||
|
579
579
|
message.sequenceNumber === undefined || message.sequenceNumber < ChromeDriver.lastReceivedSequenceNumber) {
|
580
580
|
// Should only ever happen if we sent a bad request,
|
581
581
|
// or the content script is broken
|
@@ -601,7 +601,7 @@ function parsePortMessage(message) {
|
|
601
601
|
case 19: //org.openqa.selenium.XPathLookupException
|
602
602
|
case 99: //org.openqa.selenium.WebDriverException [Native event]
|
603
603
|
toSend = {statusCode: message.response.value.statusCode, value: null};
|
604
|
-
if (message.response.value !== undefined && message.response.value
|
604
|
+
if (message.response.value !== undefined && message.response.value !== null &&
|
605
605
|
message.response.value.value !== undefined) {
|
606
606
|
toSend.value = message.response.value.value;
|
607
607
|
}
|
@@ -779,9 +779,9 @@ function switchToFrame(name, index) {
|
|
779
779
|
break;
|
780
780
|
}
|
781
781
|
}
|
782
|
-
if (name !== undefined && name
|
782
|
+
if (name !== undefined && name !== null) {
|
783
783
|
switchToFrameByName(name);
|
784
|
-
} else if (index !== undefined && index
|
784
|
+
} else if (index !== undefined && index !== null) {
|
785
785
|
getFrameNameFromIndex(index);
|
786
786
|
} else {
|
787
787
|
sendResponseToParsedRequest({
|
@@ -170,7 +170,7 @@ function parsePortMessage(message) {
|
|
170
170
|
response.wait = false;
|
171
171
|
break;
|
172
172
|
case "getTitle":
|
173
|
-
response.value = {statusCode: 0, value: ChromeDriverContentScript.currentDocument.title};
|
173
|
+
response.value = {statusCode: 0, value: Utils.trim(ChromeDriverContentScript.currentDocument.title)};
|
174
174
|
response.wait = false;
|
175
175
|
break;
|
176
176
|
case "getCurrentUrl":
|
@@ -32,7 +32,15 @@ module Selenium
|
|
32
32
|
if block_given?
|
33
33
|
original = @bridge.getCurrentWindowHandle
|
34
34
|
@bridge.switchToWindow id
|
35
|
+
|
35
36
|
yield
|
37
|
+
|
38
|
+
current_handles = @bridge.getWindowHandles
|
39
|
+
|
40
|
+
if current_handles.size == 1
|
41
|
+
original = current_handles.shift
|
42
|
+
end
|
43
|
+
|
36
44
|
@bridge.switchToWindow original
|
37
45
|
else
|
38
46
|
@bridge.switchToWindow id
|
@@ -9,13 +9,18 @@ module Selenium
|
|
9
9
|
SOCKET_LOCK_TIMEOUT = 45
|
10
10
|
|
11
11
|
|
12
|
-
def initialize(binary, port = DEFAULT_PORT,
|
12
|
+
def initialize(binary, port = DEFAULT_PORT, profile = DEFAULT_PROFILE_NAME)
|
13
13
|
@binary = binary
|
14
14
|
@port = port.to_i
|
15
|
-
@profile_name = profile_name
|
16
|
-
@profile = nil
|
17
15
|
|
18
|
-
|
16
|
+
if profile.kind_of? Profile
|
17
|
+
@profile = profile
|
18
|
+
else
|
19
|
+
@profile_name = profile
|
20
|
+
@profile = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# need to be really specific about what host to use
|
19
24
|
#
|
20
25
|
# on os x, "localhost" will resolve to 3 different addresses (see /etc/hosts)
|
21
26
|
# Ruby will loop over these and happily bind to the same port on each one,
|
@@ -69,16 +74,17 @@ module Selenium
|
|
69
74
|
end
|
70
75
|
|
71
76
|
def create_profile
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
77
|
+
unless @profile
|
78
|
+
fetch_profile
|
79
|
+
if @profile.nil?
|
80
|
+
raise Error, WebDriverError, "could not find or create profile: #{profile.inspect}"
|
81
|
+
end
|
76
82
|
end
|
77
83
|
|
78
84
|
@profile.delete_extensions_cache
|
79
85
|
|
80
86
|
@profile.port = @port
|
81
|
-
@profile.
|
87
|
+
@profile.add_webdriver_extension(true)
|
82
88
|
@profile.update_user_prefs
|
83
89
|
end
|
84
90
|
|
@@ -136,7 +142,7 @@ module Selenium
|
|
136
142
|
raise "unable to find or create new profile" unless existing
|
137
143
|
end
|
138
144
|
|
139
|
-
@profile = existing
|
145
|
+
@profile = existing
|
140
146
|
end
|
141
147
|
|
142
148
|
def assert_profile
|
@@ -32,7 +32,8 @@ module Selenium
|
|
32
32
|
]
|
33
33
|
|
34
34
|
attr_reader :name, :directory
|
35
|
-
|
35
|
+
attr_writer :secure_ssl, :native_events, :load_no_focus_lib
|
36
|
+
attr_accessor :port
|
36
37
|
|
37
38
|
class << self
|
38
39
|
|
@@ -47,17 +48,18 @@ module Selenium
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def initialize(directory = nil)
|
50
|
-
|
51
|
-
@directory = directory
|
52
|
-
else
|
53
|
-
@directory = Dir.mktmpdir("webdriver-profile")
|
54
|
-
end
|
51
|
+
@directory = directory ? create_tmp_copy(directory) : Dir.mktmpdir("webdriver-profile")
|
55
52
|
|
56
|
-
unless File.directory?
|
53
|
+
unless File.directory? @directory
|
57
54
|
raise Error::WebDriverError, "Profile directory does not exist: #{@directory.inspect}"
|
58
55
|
end
|
59
56
|
|
60
|
-
|
57
|
+
# TODO: replace constants with options hash
|
58
|
+
@port = DEFAULT_PORT
|
59
|
+
@extension_source = DEFAULT_EXTENSION_SOURCE
|
60
|
+
@native_events = DEFAULT_ENABLE_NATIVE_EVENTS
|
61
|
+
@secure_ssl = DEFAULT_SECURE_SSL
|
62
|
+
@load_no_focus_lib = DEFAULT_LOAD_NO_FOCUS_LIB
|
61
63
|
end
|
62
64
|
|
63
65
|
def absolute_path
|
@@ -69,19 +71,19 @@ module Selenium
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def update_user_prefs
|
72
|
-
prefs =
|
74
|
+
prefs = current_user_prefs.merge DEFAULT_PREFERENCES
|
73
75
|
prefs['webdriver_firefox_port'] = @port
|
74
|
-
prefs['webdriver_accept_untrusted_certs'] = 'true' unless
|
76
|
+
prefs['webdriver_accept_untrusted_certs'] = 'true' unless secure_ssl?
|
75
77
|
prefs['webdriver_enable_native_events'] = 'true' if native_events?
|
76
78
|
|
77
79
|
write_prefs prefs
|
78
80
|
end
|
79
81
|
|
80
|
-
def
|
82
|
+
def add_webdriver_extension(force_creation = false)
|
81
83
|
ext_path = File.join(extensions_dir, EXTENSION_NAME)
|
82
84
|
|
83
85
|
if File.exists?(ext_path)
|
84
|
-
return unless
|
86
|
+
return unless force_creation
|
85
87
|
end
|
86
88
|
|
87
89
|
FileUtils.rm_rf ext_path
|
@@ -103,7 +105,7 @@ module Selenium
|
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
106
|
-
if
|
108
|
+
if load_no_focus_lib?
|
107
109
|
from_to += NO_FOCUS
|
108
110
|
modify_link_library_path(NO_FOCUS.map { |source, dest| File.join(ext_path, File.dirname(dest)) })
|
109
111
|
end
|
@@ -117,20 +119,7 @@ module Selenium
|
|
117
119
|
delete_extensions_cache
|
118
120
|
end
|
119
121
|
|
120
|
-
|
121
|
-
tmp_directory = Dir.mktmpdir("webdriver-rb-profilecopy")
|
122
|
-
|
123
|
-
# TODO: must be a better way..
|
124
|
-
FileUtils.rm_rf tmp_directory
|
125
|
-
FileUtils.mkdir_p File.dirname(tmp_directory), :mode => 0700
|
126
|
-
FileUtils.cp_r @directory, tmp_directory
|
127
|
-
|
128
|
-
Profile.new(tmp_directory)
|
129
|
-
end
|
130
|
-
|
131
|
-
def port
|
132
|
-
@port ||= Firefox::DEFAULT_PORT
|
133
|
-
end
|
122
|
+
# TODO: add_extension
|
134
123
|
|
135
124
|
def extensions_dir
|
136
125
|
@extensions_dir ||= File.join(directory, "extensions")
|
@@ -157,17 +146,32 @@ module Selenium
|
|
157
146
|
end
|
158
147
|
|
159
148
|
def native_events?
|
160
|
-
|
149
|
+
@native_events == true
|
161
150
|
end
|
162
151
|
|
163
152
|
def load_no_focus_lib?
|
164
|
-
|
153
|
+
@load_no_focus_lib == true
|
165
154
|
end
|
166
155
|
|
156
|
+
def secure_ssl?
|
157
|
+
@secure_ssl == true
|
158
|
+
end
|
167
159
|
|
168
160
|
private
|
169
161
|
|
170
|
-
def
|
162
|
+
def create_tmp_copy(directory)
|
163
|
+
tmp_directory = Dir.mktmpdir("webdriver-rb-profilecopy")
|
164
|
+
|
165
|
+
# TODO: must be a better way..
|
166
|
+
FileUtils.rm_rf tmp_directory
|
167
|
+
FileUtils.mkdir_p File.dirname(tmp_directory), :mode => 0700
|
168
|
+
FileUtils.cp_r directory, tmp_directory
|
169
|
+
|
170
|
+
tmp_directory
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
def current_user_prefs
|
171
175
|
return {} unless File.exist?(user_prefs_path)
|
172
176
|
|
173
177
|
prefs = {}
|
@@ -4,24 +4,25 @@ module Selenium
|
|
4
4
|
class ProfilesIni
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
@
|
8
|
-
@
|
9
|
-
|
7
|
+
@ini_path = File.join(Util.app_data_path, "profiles.ini")
|
8
|
+
@profile_paths = {}
|
9
|
+
|
10
|
+
parse if File.exist?(@ini_path)
|
10
11
|
end
|
11
12
|
|
12
13
|
def [](name)
|
13
|
-
@
|
14
|
+
Profile.new @profile_paths[name]
|
14
15
|
end
|
15
16
|
|
16
17
|
def refresh
|
17
|
-
@
|
18
|
+
@profile_paths.clear
|
18
19
|
parse
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
24
|
def parse
|
24
|
-
string = File.read @
|
25
|
+
string = File.read @ini_path
|
25
26
|
name = nil
|
26
27
|
is_relative = nil
|
27
28
|
path = nil
|
@@ -29,8 +30,8 @@ module Selenium
|
|
29
30
|
string.split("\n").each do |line|
|
30
31
|
case line
|
31
32
|
when /^\[Profile/
|
32
|
-
if p =
|
33
|
-
@
|
33
|
+
if p = path_for(name, is_relative, path)
|
34
|
+
@profile_paths[name] = p
|
34
35
|
name, path = nil
|
35
36
|
end
|
36
37
|
when /^Name=(.+)$/
|
@@ -42,16 +43,14 @@ module Selenium
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
if p =
|
46
|
-
@
|
46
|
+
if p = path_for(name, is_relative, path)
|
47
|
+
@profile_paths[name] = p
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
def
|
51
|
+
def path_for(name, is_relative, path)
|
51
52
|
return unless [name, path].any?
|
52
53
|
path = is_relative ? File.join(Util.app_data_path, path) : path
|
53
|
-
|
54
|
-
Profile.new(path)
|
55
54
|
end
|
56
55
|
|
57
56
|
end # ProfilesIni
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-12 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|