generated automatically from #selenium on freenode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ameet01 | |
Create a properties file which holds URL: | |
environment.properties | |
env_url=http://example.com | |
Read properties, | |
Properties properties = new Properties(); | |
try(InputStream inputStream = getClass().getClassLoader().getResourceAsStream("environment.properties")) { | |
properties.load(inputStream); | |
} | |
catch (IOException e) { | |
//exception handling | |
} | |
From Java, | |
String url = properties.getProperty("env_url"); | |
Thread.sleep(3000); | |
WebDriver driver = new ChromeDriver(); | |
driver.get(url); | |
Properties file can be read in different ways. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment