Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为我的黄瓜场景编写步骤定义。但测试网站受 htaccess 登录名/密码保护。
我知道如何从 HTML 中获取元素。但是我如何通过 watir webdriver 克服这个障碍?
实际上自己找到了答案:
http://login:password@www.somewhere.com
您可以使用:
http://username:password@www.yoursite.com
我在密码中有特殊字符并收到错误:
(NS_ERROR_MALFORMED_URI) [nsIIOService.newURI] (Selenium::WebDriver::Error::UnknownError)
有帮助的是对整个 URL 进行编码,例如:
browser.goto URI.escape('http://user:!super#secure@url.com')