A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/seleniumhq/selenium/commit/b44aee0478f2b93ed229697478c7cf985ea71120 below:

[rb] use options instead of capabilities · SeleniumHQ/selenium@b44aee0 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+37

-34

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+37

-34

lines changed Original file line number Diff line number Diff line change

@@ -58,14 +58,14 @@ module Chrome

58 58

let(:options) { Chrome::Options.new(args: ['--headless']) }

59 59 60 60

it 'should return base64 for print command' do

61 -

create_driver!(capabilities: options) do |driver|

61 +

create_driver!(options: options) do |driver|

62 62

driver.navigate.to url_for('printPage.html')

63 63

expect(driver.print_page).to include(magic_number)

64 64

end

65 65

end

66 66 67 67

it 'should print with valid params' do

68 -

create_driver!(capabilities: options) do |driver|

68 +

create_driver!(options: options) do |driver|

69 69

driver.navigate.to url_for('printPage.html')

70 70

expect(driver.print_page(orientation: 'landscape',

71 71

page_ranges: ['1-2'],

@@ -74,7 +74,7 @@ module Chrome

74 74

end

75 75 76 76

it 'should save pdf' do

77 -

create_driver!(capabilities: options) do |driver|

77 +

create_driver!(options: options) do |driver|

78 78

driver.navigate.to url_for('printPage.html')

79 79 80 80

path = "#{Dir.tmpdir}/test#{SecureRandom.urlsafe_base64}.pdf"

@@ -95,7 +95,7 @@ module Chrome

95 95

options = Options.new(logging_prefs: {browser: 'ALL',

96 96

driver: 'ALL',

97 97

performance: 'ALL'})

98 -

create_driver!(capabilities: options)

98 +

create_driver!(options: options)

99 99

driver.navigate.to url_for('errors.html')

100 100

end

101 101 Original file line number Diff line number Diff line change

@@ -30,7 +30,7 @@ module Chrome

30 30

it 'passes emulated device correctly' do

31 31

options.add_emulation(device_name: 'Nexus 5')

32 32 33 -

create_driver!(capabilities: options) do |driver|

33 +

create_driver!(options: options) do |driver|

34 34

ua = driver.execute_script 'return window.navigator.userAgent'

35 35

expect(ua).to include('Nexus 5')

36 36

end

@@ -39,7 +39,7 @@ module Chrome

39 39

it 'passes emulated user agent correctly' do

40 40

options.add_emulation(user_agent: 'foo;bar')

41 41 42 -

create_driver!(capabilities: options) do |driver|

42 +

create_driver!(options: options) do |driver|

43 43

ua = driver.execute_script 'return window.navigator.userAgent'

44 44

expect(ua).to eq('foo;bar')

45 45

end

@@ -48,7 +48,7 @@ module Chrome

48 48

it 'passes args correctly' do

49 49

options.add_argument('--user-agent=foo;bar')

50 50 51 -

create_driver!(capabilities: options) do |driver|

51 +

create_driver!(options: options) do |driver|

52 52

ua = driver.execute_script 'return window.navigator.userAgent'

53 53

expect(ua).to eq('foo;bar')

54 54

end

@@ -57,7 +57,7 @@ module Chrome

57 57

it 'should be able to run in headless mode with #headless!' do

58 58

options.headless!

59 59 60 -

create_driver!(capabilities: options) do |driver|

60 +

create_driver!(options: options) do |driver|

61 61

ua = driver.execute_script 'return window.navigator.userAgent'

62 62

expect(ua).to match(/HeadlessChrome/)

63 63

end

Original file line number Diff line number Diff line change

@@ -71,7 +71,7 @@ module Edge

71 71

options = Options.new(logging_prefs: {browser: 'ALL',

72 72

driver: 'ALL',

73 73

performance: 'ALL'})

74 -

create_driver!(capabilities: options)

74 +

create_driver!(options: options)

75 75

driver.navigate.to url_for('errors.html')

76 76

end

77 77 Original file line number Diff line number Diff line change

@@ -28,7 +28,7 @@ module Edge

28 28

it 'passes emulated device correctly' do

29 29

options.add_emulation(device_name: 'Nexus 5')

30 30 31 -

create_driver!(capabilities: options) do |driver|

31 +

create_driver!(options: options) do |driver|

32 32

ua = driver.execute_script 'return window.navigator.userAgent'

33 33

expect(ua).to include('Nexus 5')

34 34

end

@@ -37,7 +37,7 @@ module Edge

37 37

it 'passes emulated user agent correctly' do

38 38

options.add_emulation(user_agent: 'foo;bar')

39 39 40 -

create_driver!(capabilities: options) do |driver|

40 +

create_driver!(options: options) do |driver|

41 41

ua = driver.execute_script 'return window.navigator.userAgent'

42 42

expect(ua).to eq('foo;bar')

43 43

end

@@ -46,7 +46,7 @@ module Edge

46 46

it 'passes args correctly' do

47 47

options.add_argument('--user-agent=foo;bar')

48 48 49 -

create_driver!(capabilities: options) do |driver|

49 +

create_driver!(options: options) do |driver|

50 50

ua = driver.execute_script 'return window.navigator.userAgent'

51 51

expect(ua).to eq('foo;bar')

52 52

end

@@ -55,7 +55,7 @@ module Edge

55 55

it 'should be able to run in headless mode with #headless!' do

56 56

options.headless!

57 57 58 -

create_driver!(capabilities: options) do |driver|

58 +

create_driver!(options: options) do |driver|

59 59

ua = driver.execute_script 'return window.navigator.userAgent'

60 60

expect(ua).to match(/HeadlessChrome/)

61 61

end

Original file line number Diff line number Diff line change

@@ -143,7 +143,7 @@ module Firefox

143 143 144 144

it 'can get and set context' do

145 145

options = Options.new(prefs: {'browser.download.dir': 'foo/bar'})

146 -

create_driver!(capabilities: options) do |driver|

146 +

create_driver!(options: options) do |driver|

147 147

expect(driver.context).to eq 'content'

148 148 149 149

driver.context = 'chrome'

Original file line number Diff line number Diff line change

@@ -40,15 +40,15 @@ def read_generated_prefs(from = nil)

40 40

end

41 41 42 42

it 'should instantiate the browser with the correct profile' do

43 -

create_driver!(capabilities: Options.new(profile: profile)) do |driver|

43 +

create_driver!(options: Options.new(profile: profile)) do |driver|

44 44

expect { wait(5).until { driver.find_element(id: 'oneline') } }.not_to raise_error

45 45

end

46 46

end

47 47 48 48

it 'should be able to use the same profile more than once' do

49 -

create_driver!(capabilities: Options.new(profile: profile)) do |driver1|

49 +

create_driver!(options: Options.new(profile: profile)) do |driver1|

50 50

expect { wait(5).until { driver1.find_element(id: 'oneline') } }.not_to raise_error

51 -

create_driver!(capabilities: Options.new(profile: profile)) do |driver2|

51 +

create_driver!(options: Options.new(profile: profile)) do |driver2|

52 52

expect { wait(5).until { driver2.find_element(id: 'oneline') } }.not_to raise_error

53 53

end

54 54

end

Original file line number Diff line number Diff line change

@@ -186,47 +186,50 @@ def check_for_previous_error

186 186

end

187 187 188 188

def create_remote_driver(**opts)

189 -

options = opts.delete(:capabilities)

190 -

opts[:capabilities] = [WebDriver::Remote::Capabilities.send(browser)]

191 -

opts[:capabilities] << options if options

192 -

opts[:url] = ENV.fetch('WD_REMOTE_URL', remote_server.webdriver_url)

193 -

opts[:http_client] ||= WebDriver::Remote::Http::Default.new

189 +

options = opts.delete(:options) { WebDriver::Options.send(browser) }

190 +

url = ENV.fetch('WD_REMOTE_URL', remote_server.webdriver_url)

194 191 195 -

WebDriver::Driver.for(:remote, **opts)

192 +

WebDriver::Driver.for(:remote, url: url, options: options, **opts)

196 193

end

197 194 198 195

def create_firefox_driver(**opts)

199 196

WebDriver::Firefox.path = ENV.fetch('FIREFOX_BINARY', nil) if ENV.key?('FIREFOX_BINARY')

200 -

WebDriver::Driver.for :firefox, **opts

197 +

options = opts.delete(:options) { WebDriver::Options.firefox }

198 +

options.debugger_address = true

199 +

options.web_socket_url = true

200 +

options.add_argument('--headless') if ENV['HEADLESS']

201 +

WebDriver::Driver.for(:firefox, options: options, **opts)

201 202

end

202 203 203 204

def create_firefox_nightly_driver(**opts)

204 205

ENV['FIREFOX_BINARY'] = ENV.fetch('FIREFOX_NIGHTLY_BINARY', nil)

205 -

opts[:capabilities] = [

206 -

WebDriver::Firefox::Options.new(debugger_address: true),

207 -

WebDriver::Remote::Capabilities.firefox(web_socket_url: true)

208 -

]

209 -

create_firefox_driver(**opts)

206 +

options = opts.delete(:options) { WebDriver::Options.firefox }

207 +

create_firefox_driver(options: options, **opts)

210 208

end

211 209 212 210

def create_ie_driver(**opts)

213 -

opts[:capabilities] = WebDriver::IE::Options.new(require_window_focus: true)

214 -

WebDriver::Driver.for :ie, **opts

211 +

options = opts.delete(:options) { WebDriver::Options.ie }

212 +

options.require_window_focus = true

213 +

WebDriver::Driver.for(:ie, options: options, **opts)

215 214

end

216 215 217 216

def create_chrome_driver(**opts)

218 217

WebDriver::Chrome.path = ENV.fetch('CHROME_BINARY', nil) if ENV.key?('CHROME_BINARY')

219 -

WebDriver::Driver.for :chrome, **opts

218 +

options = opts.delete(:options) { WebDriver::Options.chrome }

219 +

options.headless! if ENV['HEADLESS']

220 +

WebDriver::Driver.for(:chrome, options: options, **opts)

220 221

end

221 222 222 223

def create_safari_preview_driver(**opts)

223 224

WebDriver::Safari.technology_preview!

224 -

WebDriver::Driver.for :safari, **opts

225 +

options = opts.delete(:options) { WebDriver::Options.safari }

226 +

WebDriver::Driver.for(:safari, options: options, **opts)

225 227

end

226 228 227 229

def create_edge_driver(**opts)

228 230

WebDriver::Edge.path = ENV.fetch('EDGE_BINARY', nil) if ENV.key?('EDGE_BINARY')

229 -

WebDriver::Driver.for :edge, **opts

231 +

options = opts.delete(:options) { WebDriver::Options.edge }

232 +

WebDriver::Driver.for(:edge, options: options, **opts)

230 233

end

231 234 232 235

def extract_browser_from_bazel_target_name

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4