oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
656 stars 170 forks source link

click on select option, then click a button, billy driver not working, but default driver working. #295

Closed zw963 closed 3 years ago

zw963 commented 4 years ago

Following is driver used by production directly. (it working)

Capybara.register_driver :chrome_headless_with_image do |app|
  Capybara::Selenium::Driver.load_selenium
  browser_options = ::Selenium::WebDriver::Chrome::Options.new
  browser_options.args << '--headless'
  browser_options.args << '--no-sandbox'
  browser_options.args << '--disable-dev-shm-usage'
  browser_options.args << '--window-size=1920,1080'
  browser_options.args << '--timeout 10000'
  browser_options.args << '--disable-gpu' if Gem.win_platform?
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end

Following is driver used by our test only (not working)

Capybara.register_driver :selenium_chrome_headless_billy_with_image do |app|
  Capybara::Selenium::Driver.load_selenium
  browser_options = Selenium::WebDriver::Chrome::Options.new
  browser_options.args << '--headless'
  browser_options.args << '--no-sandbox'
  browser_options.args << '--enable-features=NetworkService,NetworkServiceInProcess'
  browser_options.args << '--disable-dev-shm-usage'
  browser_options.args << '--window-size=1920,1080'
  browser_options.args << '--timeout 10000'
  browser_options.args << '--disable-gpu' if Gem.win_platform?
  browser_options.args << '--ignore-certificate-errors'
  browser_options.args << "--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}"

  ::Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    options: browser_options,
    clear_local_storage: true,
    clear_session_storage: true
  )
end

I think the only difference is add a --proxy-server=??? option.

  browser_options.args << "--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}"

Following is a screenshot for this type issue.

image

Following is capybara code:

        # select month
        session.find('#ctl00_ContentPlaceHolderMain_TriesteListDispPeriodYM').select("#{month.tr('-', '年')}月")

        # select only 1 month data
        session.find('#ctl00_ContentPlaceHolderMain_TriesteListDispPeriodMonth').select("1ヶ月")

        # search 再表示 button
        button = session.find('#ctl00_ContentPlaceHolderMain_TriesteButtonReDisplay')

        # click on 再表示 => Not working. (even when driver with non-headless, click manually, month can not change to new month, always keep old month)
        button.click(wait: 20)

Thank you, if need more detail, please ping me, i can afford.

ronwsmith commented 4 years ago

What is your Billy config and does anything appear in the logs?

zw963 commented 4 years ago

What is your Billy config and does anything appear in the logs?

  1. No any billy config
  2. No any error appear in the logs, maybe you can give me more detail about how to check log? thank you.

BTW: I add VCR gem, but not used it for above issue

ronwsmith commented 4 years ago

What are you expecting puffing-billy to be doing for you? Since you mention VCR, I'm presuming some type of caching, but you have to configure puffing-billy to do the caching. Also, what is that button doing technically? If it's POSTing a form, puffing-billy will not be able to help there.

As for log files, you can generally run tail -f log/* to watch your application's activity.

ronwsmith commented 3 years ago

Stale issue, closing. Feel free to reopen.

zw963 commented 3 years ago

Thank you, missing context .... it safe to close it.