Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        3年前关闭。
                                                                                            
                
        
我在带有硒3的自动化框架中使用JavaScriptLibrary。

JavascriptLibrary无法正常工作。

JavascriptLibrary javascript = new JavascriptLibrary();
javascript.callEmbeddedSelenium(driver, "triggerEvent", ele, "change");


执行上述操作的替代方法是什么?

最佳答案

JavascriptLibrary已从Selenium 3中删除。但是,您可以使用executeScript注入自定义事件:

driver.executeScript("arguments[0].dispatchEvent(new Event('change'));", ele);

08-07 06:51