带有"@"的HTTP基本身份验证URL用密码 [英] HTTP basic authentication URL with "@" in password
问题描述
我正在尝试使用Sauce Labs对我们的登台服务器进行一些硒测试.它位于基本的http auth之后,因此从理论上讲,我可以将硒URL设置为http://user:password@www.stagesite.com
. 但是,密码中包含一个"@",这会导致各种问题,您可以想像.我尝试用反斜杠转义,但这无济于事.
I'm trying to set up some selenium tests to our staging server using Sauce Labs. It's behind a basic http auth, so theoretically I could set the selenium URL to http://user:password@www.stagesite.com
. However, the password contains a "@", causing all sorts of problems as you can imagine. I tried escaping it with a backslash but that did nothing from what I can tell.
所以
-
是否存在使用硒(即不通过URL)进行http身份验证的另一种方法.或者,
is there an alternative way to do http authentication using selenium, i.e., not via the URL. Or,
是否可以使用基于URL的身份验证,但是以某种方式告诉浏览器"@"是密码的一部分?
is there a way to use URL-based auth but somehow tell the browser that the "@" is part of the password?
推荐答案
您只需要对特殊字符进行编码,然后再将其作为URL的一部分进行传递,因此@
将需要作为%40
传递,依此类推
You just need to encode special characters like that before passing them as part of the URL, so @
would need to be passed as %40
, etc.
(我通常使用它- http://meyerweb.com/eric/tools/dencoder/-用于我的编码/解码需求.)
(I typically use this - http://meyerweb.com/eric/tools/dencoder/ - for my en/decoding needs.)
这篇关于带有"@"的HTTP基本身份验证URL用密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!