Require fix to error

1,080 views
Skip to first unread message

Manfred Lobo

unread,
Feb 19, 2018, 9:33:46 PM2/19/18
to Selenium Users
Hi there,

I am new to selenium and trying out different piece of code through online tutorials. I get this error "Exception in thread "main" java.lang.Error: Unresolved compilation problem:" when the following code written in eclipse oxygen is run.  

Also there are errors like 'The package org.openqa.selenium is accessible from more than one module: com.google.common, htmlunit.driver, selenium
- The import org.openqa.selenium.WebDriver cannot be resolved'

  Can anyone please help me out with this. Below is the code.



package co.prj1.selenium.webdriver.basic;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.chromedriver;

public class Day1 {

WebDriver  driver;
public void invokeBrowser(){
try {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\LOBO\\Desktop\\Manfred\\Edureka Tutorial\\chromedriver.exe");
driver=new chromedriver();
driver.manage().deleteAllcookies();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.manage().timeouts().pageloadtimeout(30,TimeUnit.SECONDS);
driver.get("http://www.edureka.co");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {

 Day1 myobj = new Day1();
   myobj.invokeBrowser();
 
}

}

Krishnan Mahadevan

unread,
Feb 19, 2018, 10:31:31 PM2/19/18
to seleniu...@googlegroups.com

Follow the instructions detailed here: https://www.seleniumhq.org/docs/03_webdriver.jsp#setting-up-a-selenium-webdriver-project

And then try running your code.

 

You have CLASSPATH problems (mostly due to selenium jars not available in your CLASSPATH).

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply-To: <seleniu...@googlegroups.com>
Date: Tuesday, February 20, 2018 at 8:03 AM
To: Selenium Users <seleniu...@googlegroups.com>
Subject: [selenium-users] Require fix to error

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
selenium-user...@googlegroups.com.
To post to this group, send email to
seleniu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/f5f209cd-ef87-467c-b9f3-c7c7fa37bcf0%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Swathi Donthireddy

unread,
Feb 19, 2018, 10:51:03 PM2/19/18
to Selenium Users
Hi ,


I executed in eclipse oxygen its working fine for me

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Day1 {
WebDriver  driver;
public void invokeBrowser(){
try {
//System.setProperty("webdriver.chrome.driver", "C:\\Users\\LOBO\\Desktop\\Manfred\\Edureka Tutorial\\chromedriver.exe");
driver=new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30,TimeUnit.SECONDS);
driver.get("http://www.edureka.co");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {

 Day1 myobj = new Day1();
   myobj.invokeBrowser();
 
}

}


Please check your java file  and check chrome driver path which is you have given is proper or not 
Reply all
Reply to author
Forward
0 new messages