添加SikuliX API后Selenium出现SessionNotCreatedException错误求助
问题:添加SikuliX API依赖后Selenium无法启动新会话
环境信息
- Eclipse IDE
- selenium-java v4.8.3
- SikuliX API v2.0.5
错误信息
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
已排查操作
- 确认Edge浏览器与Edge WebDriver版本兼容
- 检查msedgedriver.exe文件路径无误
- 尝试切换使用ChromeDriver,并且重启过电脑,但错误仍然存在
相关代码
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.edge.EdgeDriver; import org.sikuli.script.Screen; import org.sikuli.script.FindFailed; import org.sikuli.script.Pattern; public class HandlingUploadDownloadFiles { public static void main(String[] args) throws FindFailed { System.setProperty("webdriver.edge.driver", "D:\\Programming-Tools\\Eclipse IDE\\WebDriver\\Edge\\edgedriver_win64\\msedgedriver.exe"); WebDriver driver = new EdgeDriver(); // 实例化驱动对象 driver.get("https://www.ilovepdf.com/pdf_to_word"); // 打开链接 driver.manage().window().maximize(); // 最大化窗口 driver.findElement(By.xpath("//a[@id='pickfiles']")).click(); String filePath = "D:\\Projects\\Test Automation\\AutomationPractice\\AutomationPractice\\files\\"; Screen screen = new Screen(); Pattern inputTextField = new Pattern(filePath+"InputTextField.png"); Pattern openButton = new Pattern(filePath+"OpenButton.png"); screen.wait(inputTextField, 10); screen.type(inputTextField, filePath+"SampleFile.pdf"); screen.click(openButton); } }
错误截图

内容的提问来源于stack exchange,提问作者aewisshhh
相关产品推荐
相关产品推荐

