0
我使用Selenium和Java編寫測試。某處DOM,我們有這樣的選擇:元素是從下拉菜單中選擇的,但不是來自jQuery
<select name="operator" id="jsonform-20577-elt-operator" required="">
<option value="<"> < </option>
<option value="<="> <= </option>
<option value="="> = </option>
<option value=">"> > </option>
<option value=">="> >= </option>
</select>
當我使用:
WebElement element= wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(
"//select[@name='operator']")));
action.sendKeys(element, "<=").build().perform();
它選擇< =從下拉菜單中,但是當我們檢查從jQuery的選擇值,我們可以看到,它沒有改變(它有以前的值)。
,但如果我添加keys.ENTER
:
action.sendKeys(element, "<=",keys.ENTER).build().perform();
它的工作原理。爲什麼沒有進入就沒有工作?爲什麼從下拉框中選擇,但後來在應用程序的其他部分它仍然有以前的價值?
那麼問題是什麼? – Guy
爲什麼它沒有進入工作?爲什麼從下拉框中選擇,但後來在應用程序的其他部分它仍然有以前的價值? –