How to use bitsize method of Platform Package

Best Selenium code snippet using Platform.bitsize

platform.rb

Source:platform.rb Github

copy

Full Screen

...33 raise Error::WebDriverError, "unknown os: #{host_os.inspect}"34 end35 )36 end37 def bitsize38 @bitsize ||= (39 if defined?(FFI::BITSIZE)40 FFI::BITSIZE41 elsif defined?(FFI)42 FFI.type_size(:pointer) == 4 ? 32 : 6443 elsif jruby?44 Integer(ENV_JAVA['sun.arch.data.model'])45 else46 1.size == 4 ? 32 : 6447 end48 )49 end50 def jruby?51 engine == :jruby52 end53 def ironruby?54 engine == :ironruby55 end56 def ruby187?57 !!(RUBY_VERSION =~ /^1\.8\.7/)58 end59 def ruby19?60 !!(RUBY_VERSION =~ /^1\.9/)61 end62 def win?63 os == :windows64 end65 def mac?66 os == :macosx67 end68 def linux?69 os == :linux70 end71 def cygwin?72 RUBY_PLATFORM =~ /cygwin/73 end74 def wrap_in_quotes_if_necessary(str)75 win? && !cygwin? ? %{"#{str}"} : str76 end77 def cygwin_path(path)78 `cygpath "#{path}"`.strip79 end80 def make_writable(file)81 File.chmod 0766, file82 end83 def assert_executable(path)84 unless File.file? path85 raise Error::WebDriverError, "not a file: #{path.inspect}"86 end87 unless File.executable? path88 raise Error::WebDriverError, "not executable: #{path.inspect}"89 end90 end91 def find_binary(*binary_names)92 paths = ENV['PATH'].split(File::PATH_SEPARATOR)93 binary_names.map! { |n| "#{n}.exe" } if win?94 binary_names.each do |binary_name|95 paths.each do |path|96 exe = File.join(path, binary_name)97 return exe if File.executable?(exe)98 end99 end100 nil101 end102 end # Platform103 end # WebDriver104end # Selenium105if __FILE__ == $0106 p :engine => Selenium::WebDriver::Platform.engine,107 :os => Selenium::WebDriver::Platform.os,108 :ruby187? => Selenium::WebDriver::Platform.ruby187?,109 :ruby19? => Selenium::WebDriver::Platform.ruby19?,110 :jruby? => Selenium::WebDriver::Platform.jruby?,111 :win? => Selenium::WebDriver::Platform.win?,112 :home => Selenium::WebDriver::Platform.home,113 :bitsize => Selenium::WebDriver::Platform.bitsize114end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful