selenium selectByVisibleText不';t触发改变方法

selenium selectByVisibleText不';t触发改变方法,selenium,combobox,webdriver,Selenium,Combobox,Webdriver,我使用了selectByVisibleText,但与combobox关联的on change方法不会触发 这是组合框代码 <form id="j_idt421" class="manageUsersPickerForm ng-pristine ng-valid" style="margin: 20px 0 40px 0;" enctype="application/x-www-form-urlencoded" action="/backoffice/manage-merchant-u

我使用了selectByVisibleText,但与combobox关联的on change方法不会触发

这是组合框代码

<form id="j_idt421" class="manageUsersPickerForm ng-pristine ng-valid" style="margin: 20px 0 40px    0;" enctype="application/x-www-form-urlencoded" action="/backoffice/manage-merchant-users.xhtml" method="post" name="j_idt421">
<input type="hidden" value="j_idt421" name="j_idt421"/>
<select id="j_idt421:merchantPicker" class="floatLeft mr5" onchange="RichFaces.ajax(this,event,{"parameters"  {"cid":"14256","javax.faces.behavior.event":"change","org.richfaces.ajax.component":"j_idt421:merchantPicker"} ,"sourceId":this} )" size="1" name="j_idt421:merchantPicker"> 
<option value="-1">Select a merchant</option>
<option value="0">automerchant</option>
</select>
<input id="javax.faces.ViewState" type="hidden" autocomplete="off" value="8152201385695173409:3385672536636852427" name="javax.faces.ViewState"/>
</form>
在组合框中选择值后,页面将冻结,不会显示在另一部分

我用的是chromedriver 2.10

有人能解决这个问题吗


感谢您使用Javascript强制发生onchange事件,如下所示:

Select droplist = new Select(By.xpath("//select[contains(@id, 'merchantPicker')]"));
droplist.selectByVisibleText("automerchant");

WebElement ele = driver.findElement(By.xpath("//select[contains(@id, 'merchantPicker')]"));
JavascriptExecutor js= (JavascriptExecutor)driver;
js.executeScript("arguments[0].onchange()", ele);

谢谢你的回答,但这并不能解决我的问题。打开的更改不会触发
Select droplist = new Select(By.xpath("//select[contains(@id, 'merchantPicker')]"));
droplist.selectByVisibleText("automerchant");

WebElement ele = driver.findElement(By.xpath("//select[contains(@id, 'merchantPicker')]"));
JavascriptExecutor js= (JavascriptExecutor)driver;
js.executeScript("arguments[0].onchange()", ele);