我在等待 WebElement 可点击时使用 DefaultWait。尽管 TargetInvocationException 是我在等待期间要忽略的异常列表中的异常之一,但在达到超时期限之前,我仍然有测试因此异常而失败。这不是我所期望的。
public static void WaitAndClick(this IWebDriver driver, IWebElement webelement)
{
DefaultWait<IWebDriver> fluentWait = new DefaultWait<IWebDriver>(driver)
{
Timeout = TimeSpan.FromSeconds(Configuration.WaitTime.TotalSeconds),
PollingInterval = TimeSpan.FromMilliseconds(500)
};
fluentWait.IgnoreExceptionTypes(typeof(TargetInvocationException),typeof(NoSuchElementException),typeof(InvalidOperationException));
fluentWait.Until(ExpectedConditions.ElementToBeClickable(webelement));
webelement.Click();
}
Run Code Online (Sandbox Code Playgroud) 任何人都可以帮助我使用 Selenium webdriver(在 Python 中)代码来自动选择上述链接中输入日期中的日期。
https://www.nseindia.com/products/content/derivatives/equities/archieve_fo.htm
它只是一行代码,但我已经浪费了几个小时。有人请帮助。我已经尝试了 .send_keys() 函数并搜索了几个小时关于日期选择器问题。请帮忙。
我正在尝试运行Maven的两个黄瓜功能文件,但没有任何反应。我正在使用荷兰语(NL)的小黄瓜。当我直接在Eclipse中或使用Gradle运行功能文件时,它们运行良好。我在Stackoverflow上研究了有关此问题的所有较早问题,但仍然找不到解决方案。
这是我在Eclipse中的项目结构: Eclipse项目结构
使用命令mvn Test使用Maven运行项目的结果是:
Running nl.werkwel.cucumber.RunTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@f5c0729
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.341 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
Run Code Online (Sandbox Code Playgroud)
我也尝试使用:“ mvn test -Dcucumber.options =” src / test / resources / registratiepage.feature“,但是结果是一样的
这是POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.werkwel</groupId>
<artifactId>cucumber</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cucumber</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
<dependency> …Run Code Online (Sandbox Code Playgroud)