【发布时间】:2019-04-05 14:07:00
【问题描述】:
我正在为 Dropbox oauth 序列进行一组集成测试,该序列以一系列 302 重定向完成,其中最后一个是自定义协议/方案。在测试模仿的移动应用程序中,一切都按预期工作,而在集成测试中,一切都正常。
测试环境在 ubuntu 服务器上运行(无 GUI),使用 xvfb 无头。
客观地说,我实际上并不需要遵循自定义协议 URI,我只需要访问 URI 以确认内容符合预期。 我已经尝试了所有我能想到的从 watir/selenium 中访问包含自定义方案的 URI,但我能找到的所有参考资料都说底层细节是故意隐藏的。
我还尝试了所有我能找到的在 firefox 配置文件中创建自定义协议处理程序的选项,但无论如何都不会调用脚本。
watir/selenium 日志中没有留下任何有用的信息。
有什么想法吗?
自定义协议处理程序 sn-p:
# initialise headless
headless = Headless.new( reuse: false )
headless.start
# initialise profile
profile = Selenium::WebDriver::Firefox::Profile.new
profile[ 'general.useragent.override' ] = 'agent'
profile[ 'network.protocol-handler.app.biscuit' ] = '/usr/bin/biscuit'
profile[ 'network.protocol-handler.external.biscuit' ] = true
profile[ 'network.protocol-handler.expose.biscuit' ] = true
profile[ 'network.protocol-handler.warn-external.biscuit' ] = false
# initialise client
client = Selenium::WebDriver::Remote::Http::Persistent.new
# initialise browser
browser = Watir::Browser.new :firefox, profile: profile, accept_insecure_certs: true, http_client: client
# run dropbox authentication cycle
# cleanup
browser.close
headless.destroy
【问题讨论】:
标签: ruby firefox watir headless xvfb