我也有一个带有 UI 的 ubuntu 服务器。你可以通过触发 mvn test 命令来执行测试用例。但问题是当我从另一台机器通过终端对机器执行 ssh 时,我收到以下错误 -
unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-121-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.04 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ubuntu-test', ip: 'X.X.X.X', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-121-generic', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
Run Code Online (Sandbox Code Playgroud)
但是,如果我通过 remmina 远程控制机器,然后执行该机器终端的相同命令,则相同的命令会成功启动 chrome。
linux selenium google-chrome selenium-chromedriver selenium-webdriver
我想自动化文件上传过程,该过程使用内置bootstrap的文件上传控件.我正在使用webdriver做同样的事情.下面是我的代码,但不幸的是它不起作用:
element=driver.findElement(By.xpath("//[@id='upload']/fieldset/div[2]/input[1]"));
element.sendKeys(pathToFile);
Run Code Online (Sandbox Code Playgroud)
它给出了一个element not visible
错误.
以下是我试图自动化的bootstrap fileupload控件示例 - 通过JavaScript:在此URL上http://markusslima.github.io/bootstrap-filestyle/ 请参阅下面的样式 -
$(":file").filestyle({icon: false});
Run Code Online (Sandbox Code Playgroud) 我已将 Allure 报告与 jenkins 集成。我之前执行了大约 300 个测试用例,但目前已为此版本删除了大约 100 个测试用例。TestNG 现在只执行了 200 个测试用例,但问题是综合的最新吸引力报告仍然向我显示了所有 300 个测试用例,这使得过滤旧的和当前的测试用例变得困难。
有什么方法可以让我们使用历史记录,只显示当前活动的测试用例及其历史记录,而不显示所有以前的测试用例。
我正在研究 Selenium webDriver,其中我使用了该方法driver.manage().deleteAllCookies();
,但此方法正在删除当前域中除一个之外的所有 cookie。奇怪的!!
我现在正在使用 Chrome。
谁能建议可能的原因是什么以及我们可以采取什么措施来删除当前域的所有 cookie?
我使用下面的代码,它显示Content-Type:application/x-www-form-urlencoded,但我希望这段代码是Content-Type:application/json.请建议此代码需要进行哪些更改才能使其成为application/json请求.
private String baseUrl = "myIPAddress";
private HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(baseUrl + "app/registration");
try {
String line = "";
for (int rIndex = 0; rIndex < goodAuthenticationPairs.length; rIndex++) {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
1);
nameValuePairs.add(new BasicNameValuePair("email","myEmail@test.com"));
nameValuePairs.add(new BasicNameValuePair("password","myPassword"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
//post.setHeader("Content-type", "application/json");
System.out.println(post);
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
line = rd.readLine();
System.out.println(line);
JSONObject json = (JSONObject) new JSONParser().parse(line);
String actualResult = json.get("return_code").toString();
assertTrue("0".equals(actualResult));
}
} catch (IOException …
Run Code Online (Sandbox Code Playgroud) 我有以下代码:
@RequestMapping(
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
path = "api/api1",
method = RequestMethod.POST,
produces = MediaType.ALL_VALUE
)
public ResponseEntity<?> api1CallBack(@RequestBody String requestBody, HttpServletRequest request) throws IOException, GeneralSecurityException, URISyntaxException {
String response="{SOME_JSON}";
URI callbackURL = new URI("http://otherAPIEnv/api2");
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setLocation(callbackURL);
return new ResponseEntity<String>(response,httpHeaders, HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)
我尝试了上面的代码,但是当我通过curl击中api1时,我在同一台机器上得到了响应,但是我希望将响应重定向到otherAPIEnv机器上的api2。
有人可以建议如何实现这种要求和回应吗?
java ×3
selenium ×2
webdriver ×2
allure ×1
content-type ×1
cookies ×1
file-upload ×1
jenkins ×1
json ×1
linux ×1
spring ×1
spring-boot ×1