英文:
Possible causes are invalid address of the remote server or browser start-up failure
问题
I use Eclipse IDE, selenium-java v4.8.3, and after I added the SikuliX API version 2.0.5 in my dependencies, I encountered this error
>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.
I already checked the compatibility of my edge browser and edge webdriver, also the file path of my msedgedriver.exe. I also tried to use ChromeDriver, and restart my PC. However, I still have this error.
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(); // Instantiate driver object
driver.get("https://www.ilovepdf.com/pdf_to_word"); // Open link
driver.manage().window().maximize(); // Maximize window
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);
}
}
英文:
I use Eclipse IDE, selenium-java v4.8.3, and after I added the SikuliX API version 2.0.5 in my dependencies, I encountered this error
>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.
I already checked the compatibility of my edge browser and edge webdriver, also the file path of my msedgedriver.exe. I also tried to use ChromeDriver, and restart my PC. However, I still have this error.
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(); // Instantiate driver object
driver.get("https://www.ilovepdf.com/pdf_to_word"); // Open link
driver.manage().window().maximize(); // Maximize window
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);
}
}
答案1
得分: 1
I ran your code by just changing the version of sikuli to below, and it worked fine.
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>2.0.4</version>
</dependency>
英文:
I ran your code by just changing the version of sikuli to below, and it worked fine.
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>2.0.4</version>
</dependency>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论