简体   繁体   English

我收到错误:系统找不到指定的路径

[英]I get error : The system cannot find the path specified

When I run this test:当我运行此测试时:

public class testCase1 {

    @Test
    public void doLogin() {

        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\src\\test\\resources\\executables\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        
        driver.get("https://opensource-demo.orangehrmlive.com/");
        
        driver.findElement(By.cssSelector("#txtUsername")).sendKeys("test");
        driver.findElement(By.cssSelector("#txtPassword")).sendKeys("test");
        driver.findElement(By.cssSelector("#btnLogin")).click();
    }
}

I get this error :我收到此错误:

[RemoteTestNG] detected TestNG version 7.4.0 java.io.FileNotFoundException: C:\\Program Files\\KMSpico\\temp\\testng-eclipse-1911297100\\testng-customsuite.xml (The system cannot find the path specified) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.(FileInputStream.java:157) [RemoteTestNG] 在 java.base/ 检测到 TestNG version 7.4.0 java.io.FileNotFoundException: C:\\Program Files\\KMSpico\\temp\\testng-eclipse-1911297100\\testng-customsuite.xml(系统找不到指定的路径) java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.(FileInputStream.java:157)

What can be the problem?可能是什么问题?

from selenium import webdriver
PATH = "Your-file-path"
driver = webdriver.Chrome(PATH)
driver.get("Your-website-here")

Try out some variation of this code, if you are using windows, press shift and right click on chromedriver to copy it's path Image尝试此代码的一些变体,如果您使用的是 Windows,请按 shift 并右键单击 chromedriver 以复制其路径图像

The error is :错误是:

C:\\Program Files\\KMSpico\\temp\\testng-eclipse-1911297100\\testng-customsuite.xml C:\\Program Files\\KMSpico\\temp\\testng-eclipse-1911297100\\testng-customsuite.xml

so the error is in running the testNG runner , see your POM files surefire plugin entry point and make sure the file is present所以错误在于运行 testNG runner ,请查看您的 POM 文件surefire插件入口点并确保该文件存在

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM