gpt4 book ai didi

java - Perfectomobile 初始化错误

转载 作者:行者123 更新时间:2023-12-01 13:17:07 25 4
gpt4 key购买 nike

我正在尝试使用 Eclipse 中的 Perfectomobile 在移动设备上测试网站。我在运行代码时收到初始化错误。看起来像是http请求错误。我想知道是否有一个代理我可以尝试使用 eclipse。我可以直接在浏览器上访问此网址。

这是初始化代码

public class MobileTest {

public static void main(String[] args) {
String deviceID = "1F297702";
\\Initializing
MobileDriver driver = new MobileDriver();

try {
//code area
driver.getDevice(deviceID);

sleep(13000);
MobileDeviceOpenOptions open = new MobileDeviceOpenOptions();
driver.getDevice(deviceID).open(open);

和错误控制台

Error:
Run started
Starting Mobile Driver
12:16:55.103 [main] INFO c.p.selenium.MobileDriver - Creating mobile driver
12:16:55.109 [main] INFO c.p.selenium.MobileDriver - Starting execution
12:16:55.142 [main] INFO c.p.httpclient.HttpClient - Processing request Request[_requestType=START_EXECUTION,_itemId=<null>,_parameters=[ParameterValue[_name=responseFormat,_value=xml]],_stringParameters=<null>,_encoding=<null>]

Exception in thread "main" java.lang.RuntimeException: Failed to start play
at com.perfectomobile.selenium.MobileDriver.initWithEclipseParams(MobileDriver.java:86)
at com.perfectomobile.selenium.MobileDriver.<init>(MobileDriver.java:39)
at MobileTest.main(MobileTest.java:41)

Caused by: com.perfectomobile.httpclient.HttpClientException: Error while processing HTTP request for URL in https & username & password
at com.perfectomobile.httpclient.HttpClient.sendTextRequest(HttpClient.java:195)
at com.perfectomobile.httpclient.HttpClient.sendTextRequest(HttpClient.java:143)
at com.perfectomobile.httpclient.HttpClient.sendValuesRequest(HttpClient.java:56)
at com.perfectomobile.httpclient.execution.ExecutionsHttpClient.startPlay(ExecutionsHttpClient.java:217)
at com.perfectomobile.selenium.MobileDriver.initWithEclipseParams(MobileDriver.java:76)

最佳答案

是 - Perfecto 移动支持代理

请参阅附加代码:

// Setting up the proxy
MobileProxy proxy = new MobileProxy("name",
8080, "XXX "XXX");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
MobileDriver connector = new MobileDriver(capabilities);
System.out.println("Script started");

有关更多代码示例,您可以访问: https://github.com/perfectomobile/examples

关于java - Perfectomobile 初始化错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22384896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com