Capybara 在我的电脑中打开一个 html 文件 [英] Capybara open an html file in my computer

查看:18
本文介绍了Capybara 在我的电脑中打开一个 html 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的电脑中有一个 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 :)

更新:根据水豚源代码here,我发现我应该使用 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

这篇关于Capybara 在我的电脑中打开一个 html 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆