I have setup selenium in Intellij Idea. But when tried to create a simple instance it doesn't recognize "get" method.
This is what I have done up to now.

System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32");
WebDriver driver = new ChromeDriver();   
driver.get("http://www.google.com");  // get is in red and doesn't allow to import any package
Thread.sleep(5000); // Sleep also has same problem       

How can I fix this?
I have added jar files. I'm using java webdriver

I have added jars inside the zip of selenium downloaded file
I did imports as they were suggested. I deleted the project. So, I don't have the code and imports now.
Even the thread cant identify its methods. For and example Thread. doesn't suggest methods available.
declaring the driver didn't cause any trouble. But driver.doesn't suggest any method including 'get'

Image of the code

  • 1
    Lets improve your question so that more folks could help you. Which jars did you add? Show us your imports. Which problems does your Thread.sleep have? What happens if you type "driver." after "WebDriver driver = new ChromeDriver(); " line? Does code assistant show you some available methods to select?
    – Alexey R.
    Jul 12 '18 at 8:24
  • May I add an image?
    – Joe
    Jul 12 '18 at 8:29
  • Let's try and edit later if it won't help.
    – Alexey R.
    Jul 12 '18 at 8:30
  • Ok give me several minutes
    – Joe
    Jul 12 '18 at 8:31
  • @AlexeyR., I have added more info in the question please check
    – Joe
    Jul 12 '18 at 8:38

Please add all the dependent jars to your project. You are getting the RED color in the method calls because the corresponding classes are not present in the project and JDK is not able to resolve the path.

Go to Module settings --> add the selenium jar --> apply


I found the answer for the problem. All I had to do is include the code inside a main method as follows.

public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();

You need to use URL (https://en.wikipedia.org/wiki/URL) which means full https (or http) address to make it work. Try:

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumDemo { WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com"); Thread.sleep(5000); }

  • I havent use the same link here and it has http and properly declared
    – Joe
    Jul 12 '18 at 6:06
  • I do not understand what you did. Can you paste in the whole stacktrace from IntelliJ? And your full .java file (probably you messed up imports) Jul 12 '18 at 6:08
  • All im getting is Cannot resolve symbol 'get'
    – Joe
    Jul 12 '18 at 6:10
  • Probably you didn't get imports on the top, and didn't properly created Java Class. Try edited code? Jul 12 '18 at 6:15
  • I have imported all those
    – Joe
    Jul 12 '18 at 6:32

Import the Remote Webdriver and run the code. This will work.

RemoteWebDriver driver;

or else try this below code

System.setProperty("webdriver.chrome.driver", "give the chrome driver path here");
ChromeDriver driver = new ChromeDriver();
//To maximize the window
//Need to load the url

methods not suggested issue

  • I have set chromedriver path as a environment variable and it works in another project properly
    – Joe
    Jul 12 '18 at 6:23
  • Check the current project chrome driver path and update. Else update the new chrome driver. Jul 12 '18 at 6:30
  • Itried to set the path manually as you have told in second code segment. But it doesn't recognize "setProperty" Says "Cannot resolve symbol setProperty"
    – Joe
    Jul 12 '18 at 6:32
  • Can u pls share the code which u have created now so that i can help u Jul 12 '18 at 6:38
  • I have added the new code on above the existing code.
    – Joe
    Jul 12 '18 at 6:44

My suggestion is to check your driver path is correct or not.


eclipse--window-preference--java-editor--advance--select all java proposals

it worked for me

  • 5
    Please also add why this should solve the problem, adding concrete steps is usually considered not a complete answer.
    – pavelsaman
    Jun 16 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.