问题描述
我的计算机中有一个html文件,我想使用Capybara打开该文件进行测试.您能帮我解决这个问题吗?
I have an html file in my computer and I want to open that file using Capybara to test it. Could you help me to solve this problem?
P/S:该html文件是在我的应用中自动创建的.我非常感谢帮助我解决此问题的任何想法.谢谢:)
P/S: That html file is created automatically in my app. I do appreciate any idea helping me to solve this problem. Thanks :)
更新:基于capybara源代码此处,我发现我应该使用Capybara.current_session.driver.visit而不是page.visit.问题解决了
UPDATE:Based on the capybara source code here, I found that I should use Capybara.current_session.driver.visit instead of page.visit. The problem is solved
推荐答案
我可以确认对问题的更新有效(假设文件位于当前目录中):
I can confirm that the update to the question works (assuming the file is in the current directory):
filename = 'foo.html'
Capybara.current_session.driver.visit filename
这篇关于水豚在我的电脑中打开一个html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!