我正在使用Selenium和Python。单击此处的图像元素:
element = wait.until(EC.element_to_be_clickable((By.XPATH,'(//td[span[normalize-space(text())="Ram Lal"]])[1]/following-sibling::td[./input[@type="image"]]')))
这是按钮用于恢复页面的内容,这在Selenium中不会发生:
<input type="image" src="/rhis/images/add2.png" onclick="A4J.AJAX.Submit('modalFormResultPatientSearchPatientSearchForm',event,{'oncomplete':function(request,event,data){Richfaces.hideModalPanel('modalFormResultPatientSearch');},'similarityGroupingId':'modalFormResultPatientSearchPatientSearchForm:patientSearchDataTableId:0:patientContorlsubmitSearch','parameters':{'backingBeanName':'','patientId':'903242','patSearchMrno':'UH0000004013','onPatientSelectCallBack':'','modalFormResultPatientSearchPatientSearchForm:patientSearchDataTableId:0:patientContorlsubmitSearch':'modalFormResultPatientSearchPatientSearchForm:patientSearchDataTableId:0:patientContorlsubmitSearch'} ,'eventsQueue':'modalFormResultPatientSearchsearcha4jQueue'} );return false;" name="modalFormResultPatientSearchPatientSearchForm:patientSearchDataTableId:0:patientContorlsubmitSearch" id="modalFormResultPatientSearchPatientSearchForm:patientSearchDataTableId:0:patientContorlsubmitSearch">
我假设这是一个模态窗口问题,我徒劳地尝试了这个技巧:
driver.execute_script('var el=arguments[0]; setTimeout(function() { el.click(); }, 100);', element)
新模态窗口不出现的原因是什么?