我是酱实验室的菜鸟。我第一次在Appium Desired功能上运行了Sauce实验室,并收到以下错误消息:
unable to parse remote response: Misconfigured -- Sauce Labs Authentication Error.
You used username 'USERNAME' and access key 'ACCESS_KEY' to authenticate, which are not valid Sauce Labs credentials.
我的问题是这个
这是我所需的功能代码:
public static final String USERNAME = "confidential";
public static final String ACCESS_KEY = "condfidential";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";
public static void main(String[] args) throws MalformedURLException{
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("platformName", "iOS");
cap.setCapability("deviceName", "iPhone8 Simulator");
cap.setCapability("platformVersion", "11.3");
cap.setCapability("browserName", "Safari");
cap.setCapability("deviceOrientation", "portrait");
WebDriver driver= new RemoteWebDriver(new URL("http://USERNAME:ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub"),cap);
driver.get("https://www.bbc.co.uk/");
错误消息:
Unable to parse remote response: Misconfigured -- Sauce Labs Authentication Error.
You used username 'USERNAME' and access key 'ACCESS_KEY' to authenticate, which are not valid Sauce Labs credentials.
The following desired capabilities were received:
{'browserName': 'Safari',
'deviceName': 'iPhone8 Simulator',
'deviceOrientation': 'portrait',
'platformName': 'iOS',
'platformVersion': '11.3'}
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'
System info: host: 'xxx-MacBook-Air.local', ip: '100.100.0.0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_71'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:111)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
at iOSCloudTesting.IosCloudSauce.main(IosCloudSauce.java:26
答案 0 :(得分:0)
代替“ USERNAME”,您必须提及您的调味料实验室用户名;代替“ ACCESS_KEY”,您应提及帐户的调味料实验室访问密钥 在下一行。
WebDriver driver= new RemoteWebDriver(new URL("http://USERNAME:ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub"),cap);
如何获取访问密钥?
1。登录调味酱实验室,单击仪表板上。
2。单击您的帐户菜单。单击我的帐户。
3。您会找到访问密钥部分。
4。单击显示按钮。它将要求授权。
5。输入密码并复制访问密钥
答案 1 :(得分:0)
对于酱料实验室,您必须先注册,然后获取USERNAME和ACCESS_KEY。
用户名您需要在注册过程中进行设置,而access_key是自己生成的令牌,可以从下面获取。
public static final String USERNAME = "user52";
public static final String ACCESS_KEY = "Das3$s1";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("platform", "Windows 10");
caps.setCapability("version", "latest");
//Your issues is with this line. Just run URL string where You previously have setup everything before
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
driver.get("https://saucelabs.com/test/guinea-pig");
System.out.println("title of page is: " + driver.getTitle());
driver.quit();
}
因此,您需要试用一两个星期,然后付款。因此,首先获取用户名和访问密钥,然后从上方运行示例代码。
希望这会有所帮助,