Cucumber/Capybara -- 如何获取当前执行的主机和端口端口、主机、Cucumber、Capybara

2023-09-07 23:39:01 作者:第一眼便沉沦

我需要使用 Open::URI 从我的应用程序中下载一个 csv 文件,为此我需要为其提供一个完全限定的 URI.那么在我的黄瓜脚本中获取 HOST 和更重要的是 PORT 的最佳方法是什么?

I need to download a csv file from my app using Open::URI and to do that I need to give it a fully qualified URI. So whats the best way to get the HOST and more importantly PORT in my cucumber script?

注意我正在使用 Capybara 和 Selenium

Note I am using Capybara and Selenium

推荐答案

您可以设置将用于生成应用程序服务器的端口

You can set port that will be used to spawn an application server

Capybara.server_port = 31337