Resolving "IllegalStateException: Webdriver.chrome.driver System Property Misconfigured" in Java
The exception "java.lang.IllegalStateException: The path to the driver executable must be set" indicates that the WebDriver setup is incorrect. To rectify this issue, follow these instructions:
Incorrect Property Name
Notice that in the code snippet provided, the property is misspelled as "Webdriver.chrome.driver" with uppercase "W". Correct this to "webdriver.chrome.driver" with lowercase "w".
Absolute Path and Extension
The error message suggests that the driver executable path is not specified properly. Ensure that you provide the absolute path to the chromedriver.exe executable file. For Windows systems, the path should include the file extension.
Corrected Code
Below is the corrected version of your code:
<code class="java">package Basics; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class invokegoogle { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:\Users\sravani\Desktop\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://qaclickacademy.com"); } }</code>
Note:
The above is the detailed content of How to Fix \'IllegalStateException: Webdriver.chrome.driver System Property Misconfigured\' Error in Java?. For more information, please follow other related articles on the PHP Chinese website!