尝试自动化我们的应用程序时,有两个具有相同名称的按钮.
我无法找到识别这些的方法.请告诉我在java中的selenium webdriver中识别这些元素的其他方法
使用下面这行代码,可以执行 login.feature 中提到的所有场景。
@CucumberOptions(features= "src/main/resources/publish/login.feature", format = {"pretty"} )
Run Code Online (Sandbox Code Playgroud)
如果我必须执行多个特征文件,我该如何定义?假设我定义如下,发布文件夹中提到的功能将被执行。
@CucumberOptions(features= "src/main/resources/publish", format = {"pretty"} )
Run Code Online (Sandbox Code Playgroud)
如果我必须在其中运行多个功能和场景,我该如何定义?我必须创建多个cucumberRunner类还是可以在一个类文件中定义。
尝试放心地测试其余 api。收到错误
路径参数数量无效。预计为 0,实际为 3。
public class GetSociailDetails {
@Test
public void generateToken() {
Map<String,String> userDetails = new HashMap<>();
userDetails.put("msISDN", "1217071016");
userDetails.put("messageSource", "TWITTER");
userDetails.put("socialId", "168988132");
given()
.contentType("application/json")
.pathParam("access_token", "LLRPqxvU1uoT8YSl8")
.pathParam("pageNo", "1")
.pathParam("order", "desc")
.body(userDetails)
.post("http://name.com/rest/crm/getdetails")
.then()
.statusCode(200);
}
}
Run Code Online (Sandbox Code Playgroud)
是否有其他方法可以在 POST 方法的其余 api 中传递 url 参数。
path is not absolute: src/test/resources/testData/twt_Pic.jpg 使用 selenium 上传文件时出现此异常。
不是使用本机 os 文件资源管理器上传文件,而是将密钥发送到路径文件。
在旧版本中使用相同的路径,不确定它是哪个版本。
Chrome 中的错误登录:
org.openqa.selenium.WebDriverException: unknown error: path is not absolute: src/test/resources/testData/twt_Pic.jpg
(Session info: chrome=66.0.3359.181)
(Driver info: chromedriver=2.39.562713 (dd642283e958a93ebf6891600db055f1f1b4f3b2),platform=Mac OS X 10.13.4 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'nagarjunaMBP.local', ip: 'fe80:0:0:0:c2e:b816:67ae:922b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, …Run Code Online (Sandbox Code Playgroud) 生成成功后,报告将成功生成,但是如果有任何失败的情况导致生成失败,则不会生成报告。
checkBuildResult已设置为false
pom文件插件
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>3.13.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>Simplify360 Automation Test Report</projectName>
<outputDirectory>${project.build.directory}/site/cucumber-reports</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
<!-- <jsonFiles>
<param>${project.build.directory}/cucumber.json</param>
</jsonFiles> -->
<!-- <parallelTesting>false</parallelTesting> -->
<buildNumber>8.4.1.2</buildNumber>
<checkBuildResult>false</checkBuildResult>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
跑步班如下
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"classpath:features"},
plugin = {"pretty","json:target/cucumber.json"},
tags = {"@currentTest"},
glue={"helpers","stepDefinitions"},
monochrome = true
)
public class RunCukesTest{
}
Run Code Online (Sandbox Code Playgroud)