已关闭。此问题需要更多focused。当前不接受答案。
**想要改进此问题吗?**更新问题,使其仅关注editing this post的一个问题。
昨天关门了。
Improve this question
在特征值中,iam发送一个值,i需要生成一个随机值,以US +随机数开始,我们如何才能从特征文件中获取值```然后使用以下内容更新部分标识符部分json“””{ 'ISIN':'US 1525469866','VALOR':'A123500' }“””
@Then("update section Identifiers section with following json")
public void updateSectionIdentifiersSectionWithFollowingJson(String json) {
PageAddInvest PageObjectsFundEligibilityIdentiferAddReInvestleg = new PageAddInvest (Objects.requireNonNull(seleniumCore.getWebDriver()));
FI objectIdentifiersFromFeatureFile = parserService.jsonToObject(json, FundIdentifier.class);
boolean b = PageObjectsFundEligibilityIdentiferAddReInvestleg.updateSectionFields(objectIdentifiersFromFeatureFile);
Assert.assertTrue("Update for the Identifiers details section failed", b);
}
@Override
public boolean updateSectionFields(DataObject dataObject) {
boolean flag = false;
FI objFundName = (FundIdentifier) dataObject;
try {
if (ISIN.isEnabled()) {
flag = Update(ISIN, objFundName.getISIN());
}
if (VALOR.isEnabled()) {
flag = UpdateFieldValues(VALOR, objFundName.getVALOR());
}
} catch (Exception e) {
log.error(String.valueOf(e));
}
return flag;
}
public boolean Update(WebElement ele, String valueToField) {
boolean flag = false;
try {
if (element.getAttribute(VALUE).length() <= 0) // Enter value If field value is empty
{
ele.sendKeys(valueToField);
ele.click();
ele
t.sendKeys(Keys.ENTER);
} else {
ele.clear();// If any field already has value ,clear the value and enter the new value from feature file
ele.sendKeys(valueToField);
}
flag = true;
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
to generate a new method for generating random number
1条答案
按热度按时间yzuktlbb1#
一种方法是:
Apache共享库:
输出量: