问题描述
当我尝试连接api时出现错误, 我接受xyz.com的http failer响应
我的ts文件:
window
,输出为:
我的android清单是:
description: My Test
actors:
- actor: ACTOR1
segments:
- segment: 1
actions:
- description: Initialize browser
action: org.getopentest.selenium.Navigateto
args:
url: $data("config").someExternalUrlIsAlive
- description: Get Test Page File-Path
script: |
var File = Java.type("java.io.File");
var URLEncoder = Java.type("java.net.URLEncoder");
var StandardCharsets = Java.type("java.nio.charset.StandardCharsets");
var testPage = new File("..\\test-repo\\scripts\\testpage.html");
var testPageUrl = testPage.getAbsolutePath();
var argument = $data("config").someProperty;
var argumentUrlEncoded = URLEncoder.encode(argument,StandardCharsets.UTF_8.toString());
$sharedData.testpage = testPageUrl + "?arg=" + argumentUrlEncoded;
$log("The test-page path is " + $sharedData.testpage);
- description: Navigate to Test Page
action: org.getopentest.selenium.Navigateto
args:
url: $sharedData.testpage
- description: Start Test
action: org.getopentest.selenium.Click
args:
locator: { id: btnTest }
- description: Give the test some time to complete
script: |
var Thread = Java.type("java.lang.Thread");
Thread.sleep(3000); // sleep 3 seconds.
- description: Read Test Page Result
action: org.getopentest.selenium.GetElements
args:
locator: { id: txtResult }
$localData:
resultElements: $output.elements
- description: Validate the Test Page Results
script: |
var txtResult = $localData.resultElements[0];
var testResult = txtResult.getAttribute("value")
if (testResult !== "200") {
$fail(
$format(
"We expected a valid connection result,but we got: {0}",testResult
)
);
}
我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)