puppeteer.rb 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. require 'concurrent'
  2. module Puppeteer; end
  3. require 'puppeteer/env'
  4. # Custom data types.
  5. require 'puppeteer/events'
  6. require 'puppeteer/errors'
  7. require 'puppeteer/geolocation'
  8. require 'puppeteer/viewport'
  9. # Modules
  10. require 'puppeteer/concurrent_ruby_utils'
  11. require 'puppeteer/define_async_method'
  12. require 'puppeteer/debug_print'
  13. require 'puppeteer/event_callbackable'
  14. require 'puppeteer/if_present'
  15. # Classes & values.
  16. require 'puppeteer/aria_query_handler'
  17. require 'puppeteer/browser'
  18. require 'puppeteer/browser_context'
  19. require 'puppeteer/browser_runner'
  20. require 'puppeteer/browser_connector'
  21. require 'puppeteer/cdp_session'
  22. require 'puppeteer/chrome_target_manager'
  23. require 'puppeteer/connection'
  24. require 'puppeteer/console_message'
  25. require 'puppeteer/coverage'
  26. require 'puppeteer/css_coverage'
  27. require 'puppeteer/custom_query_handler'
  28. require 'puppeteer/devices'
  29. require 'puppeteer/dialog'
  30. require 'puppeteer/emulation_manager'
  31. require 'puppeteer/exception_details'
  32. require 'puppeteer/executable_path_finder'
  33. require 'puppeteer/execution_context'
  34. require 'puppeteer/file_chooser'
  35. require 'puppeteer/firefox_target_manager'
  36. require 'puppeteer/frame'
  37. require 'puppeteer/frame_manager'
  38. require 'puppeteer/http_request'
  39. require 'puppeteer/http_response'
  40. require 'puppeteer/isolated_world'
  41. require 'puppeteer/js_coverage'
  42. require 'puppeteer/js_handle'
  43. require 'puppeteer/keyboard'
  44. require 'puppeteer/launcher'
  45. require 'puppeteer/lifecycle_watcher'
  46. require 'puppeteer/mouse'
  47. require 'puppeteer/network_conditions'
  48. require 'puppeteer/network_event_manager'
  49. require 'puppeteer/network_manager'
  50. require 'puppeteer/page'
  51. require 'puppeteer/protocol_stream_reader'
  52. require 'puppeteer/puppeteer'
  53. require 'puppeteer/query_handler_manager'
  54. require 'puppeteer/remote_object'
  55. require 'puppeteer/target'
  56. require 'puppeteer/task_manager'
  57. require 'puppeteer/tracing'
  58. require 'puppeteer/timeout_helper'
  59. require 'puppeteer/timeout_settings'
  60. require 'puppeteer/touch_screen'
  61. require 'puppeteer/version'
  62. require 'puppeteer/wait_task'
  63. require 'puppeteer/web_socket'
  64. require 'puppeteer/web_socket_transport'
  65. # subclasses
  66. require 'puppeteer/element_handle'
  67. # ref: https://github.com/puppeteer/puppeteer/blob/master/lib/Puppeteer.js
  68. module Puppeteer
  69. @puppeteer ||= ::Puppeteer::Puppeteer.new(
  70. project_root: __dir__,
  71. preferred_revision: '706915',
  72. is_puppeteer_core: true,
  73. ).tap do |instance|
  74. instance.public_methods(false).each do |method_name|
  75. define_singleton_method(method_name) do |*args, **kwargs, &block|
  76. if kwargs.empty? # for Ruby < 2.7
  77. @puppeteer.public_send(method_name, *args, &block)
  78. else
  79. @puppeteer.public_send(method_name, *args, **kwargs, &block)
  80. end
  81. end
  82. end
  83. end
  84. end