我遇到了一个奇怪的问题,我将我的应用程序主机设置为远程站点,如下所示:
Capybara.configure do |config|
config.default_max_wait_time = 10 # seconds
config.default_driver = :selenium_chrome
config.app_host = 'https://dev.stagingsite.com/widget-web/#/'
end
所有相对路径都在 /#/
之后,所以在我的访问方法中(例如 session.visit('login')
将带我到 URL:
https://dev.stagingsite.com/widget-web/login#/
我试过在不同的地方添加“/”,转义 #
但它似乎无法将相对 url 放在 #
之后,而是总是尝试把它放在 widget-web/
知道这里发生了什么吗?
最佳答案
来自 MDN 的 URL 文档:
It is worth noting that the part after the #, also known as the fragment identifier, is never sent to the server with the request.
检查您的服务器日志;您会看到任何对 /widget-web/#/
的请求都会作为对 /widget-web/
的请求发送。 #
阻止将其后的任何内容发送到服务器。
关于ruby - Capybara 'visit' 不考虑 URL 中的 '#' 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57529387/