下拉框数值改变

huangapple go评论87阅读模式
英文:

Drop down box value changes

问题

我开始为我目前的公司创建自动化框架。现在我在一个表单上遇到了一个问题,该表单顶部附着着一个JS模态框。每当我更改表单的默认值时(检测到变更:保存按钮、取消按钮),那个JS表单都会出现。问题在于有一个下拉框,其默认值设置为空。在我将其更改为一个值(例如:房屋)后,就会出现我制造的JS模态框,指示我对表单进行了更改,并将下拉框的值更改为默认的空值。这是在运行时发生的。如果我使用thread.sleep暂停3秒,可以解决这个问题。但我需要一个更可靠的解决方案。是否有其他选项可供我解决这个问题?

英文:

I started creating an automation framework for my current company. now I’m having a problem with a form that has a JS modal appearing top part of the form attaches to it. that JS form comes every time if I change the default value of the form (Changes Detected: save button, dismissed button). the issue is there is a drop-down box and the default value is set to empty. after I change that to a value (eg: house) that JS modal comes that I have made a change to the form and put the value of the drop-down box to that default empty value. this happens in the run time. if I put a thread.sleep for 3 seconds that solves the issue. but I need a more reliable solution. are there any other options that I can use for this issue?

答案1

得分: 1

现在我能想到的只是调用第一个函数,等待成功

WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.javaScriptThrowsNoExceptions("putValue()"));

可能会有一点点。

英文:

All I can think of now is to call that first function, Wait for success

WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.javaScriptThrowsNoExceptions("putValue()"));

May be a little bit

huangapple
  • 本文由 发表于 2020年5月5日 08:22:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/61603804.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定