ferrum icon indicating copy to clipboard operation
ferrum copied to clipboard

Enable mobile emulation

Open duncan-bayne opened this issue 11 months ago • 2 comments

There is a request on Cuprite to support mobile emulation: https://github.com/rubycdp/cuprite/issues/216

A prerequisite for this is for Ferrum to support mobile: true in Page#resize. This PR adds that support.

Note that passing mobile: true also sets the screen resolution to that of an iPhone 14; see this comment. Perhaps there's a nicer way of doing this?

Merging this should let us close #94.

duncan-bayne avatar Mar 21 '25 00:03 duncan-bayne

Moving this back to draft, for now, while I clean up following a move of the mobile specific stuff into Cuprite.

duncan-bayne avatar Mar 27 '25 12:03 duncan-bayne

Okay I think this is good for review again :)

Note the new, improved, and not-hard-coded API. In Cuprite you'd do:

Capybara.register_driver :custom_cuprite_mobile do |app|
  mobile_cuprite_options = cuprite_options.merge(Capybara::Cuprite::Devices::IPHONE_14)
  Capybara::Cuprite::Driver.new(app, mobile_cuprite_options)
end

duncan-bayne avatar Apr 03 '25 23:04 duncan-bayne