我目前有以下设置,但我不确定我的等待(隐式和 pageLoadTimeout)是否有效。这是正确的实现吗?通过将它放在@Before("@setup") 中,它是否适用于每个场景或步骤定义运行?每次我打电话给@Given、@When.. 等时,司机会相应地等待吗?
@Before("@setup")
public void setUp() {
driver.manage().deleteAllCookies();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
}
Run Code Online (Sandbox Code Playgroud)
为什么需要给下面的wait分配一个WebElement,WebElement元素接收什么?这是正确的实现吗?——
WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(id)));
boolean status = element.isDisplayed();
Run Code Online (Sandbox Code Playgroud) 在我的情况下,我很难理解和利用依赖注入。我想使用 Pico-container ( https://cucumber.io/blog/2015/07/08/polymorphic-step-definitions )。
这是我的情况......我目前有一个包含我所有 selenium 的 step 定义类,并且它变得太大了:
public class StepDefinitions{
public static WebDriver driver; // a driver is returned here from a static Driver Factory Class
LoginPage loginPage = new LoginPage(driver); //Page Object Model(s)
@Before("setup")
@After //screen snapshot
@After("destroy")
@Given //many methods with this tag
@When //many methods with this tag
@Then //many methods with this tag
}
Run Code Online (Sandbox Code Playgroud)
现在我想可能有一个包含我的驱动程序、POM 和 Hooks 的类:
public static WebDriver driver; //driver is returned from a static Driver Factory Class
LoginPage loginPage …Run Code Online (Sandbox Code Playgroud) 将以下插件添加到我的 pom.xml 中时,应该在我的目标文件夹中生成一份报告,但没有生成任何内容。我的项目只是运行并完成,没有任何报告。有人可以检查一下是否有任何错误吗?
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>CucumberWebGui</projectName>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我试图在Ubuntu 16中下载Appium Desktop(到目前为止我刚刚使用终端运行它).
我理解,对于Ubuntu,我必须下载他们在git上的源代码版本(源代码tar.gz),与他们的.exe(windows)或.dmg(mac)版本相关.下载并取消后,我不知道如何"安装"它.我试过读README.md,但找不到指令.这该怎么做?
提前谢谢了
cucumber ×2
java ×2
appium ×1
appium-ios ×1
automation ×1
frameworks ×1
implicitwait ×1
maven ×1
pom.xml ×1
selenium ×1