Discussion:
[selenium-users] Require fix to error
Manfred Lobo
2018-02-19 18:54:37 UTC
Permalink
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();

}

}
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@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.
Krishnan Mahadevan
2018-02-20 03:30:49 UTC
Permalink
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: <selenium-***@googlegroups.com>
Date: Tuesday, February 20, 2018 at 8:03 AM
To: Selenium Users <selenium-***@googlegroups.com>
Subject: [selenium-users] Require fix to error



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();

                              

                }



}



--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@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.
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/01B65898-F825-4706-9BB1-0B407E624FD9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Swathi Donthireddy
2018-02-20 03:51:03 UTC
Permalink
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
Post by Manfred Lobo
Hi there,
I am new to selenium and trying out different piece of code through online
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();
}
}
--
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-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/db143d5a-632e-474f-ac35-5452012bcb4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...