[英]How to handle the basic authentication (Rest API- Post Request) with selenium webdriver code?
如何使用selnium Webdriver和Java处理Rest-API的基本身份验证
Actually you have more than one solution: 实际上,您有多个解决方案:
1- You can use user:password@yourURL.com (Make sure that username or password doesn't contain any special characters). 1-您可以使用user:password@yourURL.com(确保用户名或密码不包含任何特殊字符)。
2- You can add a header key "Authorization" to your request with credEncodedString as a value for that key: byte[] credentials = (userName + ":" + password).getBytes(); 2-您可以使用credEncodedString作为该密钥的值向请求添加标头密钥“ Authorization”:byte []凭据=(userName +“:” +密码).getBytes(); String credEncodedString = "Basic " + Base64Encoder.encode(credentials); 字符串credEncodedString =“ Basic” + Base64Encoder.encode(credentials);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.