0
您也可以在配置文件中的數據作爲 test_data_path = C:\\Sudheer\\Sudheer\\Selinium scripts\\Webdriverscrip\\Automation_Project\\TestData\\Nlpapplication.xlsx
不從配置文件中硒的webdriver
運行我下面的腳本結果顯示有一個斜線失蹤
C:\Sudheer\Sudheer\Selinium scripts\Webdriverscrip\Automation_Project\TestData\Nlpapplication.xlsx
public class Testconfigvalues {
public static void main(String[] args) throws IOException {
FileInputStream fs = null;
fs = new FileInputStream(System.getProperty("user.dir")+"\\config.properties");
Properties property=new Properties();
property.load(fs);
String data_test_data_path = property.getProperty("test_data_path");
System.out.println("value is " +data_test_data_path);
}
}
感謝阿里,剛纔看到你的帖子,會盡量讓你知道 – Sudheer
你能接受的答案,如果它爲你工作。 –
而且我還發現了另一種使用TESTNG的方法,我在Testng.xml文件中直接給出了調用參數的路徑。這有助於我的代碼可以重用到我的團隊,因爲他們可以在xml文件中提供路徑而不是代碼 –
Sudheer