-1

I am currently having a bad first time experience of using this forum, with my questions being repeatedly deleted as duplicates despite my explaining that the suggested fixes are not solving my problem. The cause of the first questioner’s error was incorrect jars, I appear to have the correct ones according to the list proposed in that thread.

This is my code:

package sanityTests;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Login {

public static void main(String[] args) {
    System.setProperty("webdriver.gecko.driver", "/Users/lawrencedonohoe/Downloads/geckodriver");
    WebDriver driver = new FirefoxDriver();



    }

}

I am getting the following error:

Unresolved compilation problem: WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type

I gather from other forum articles that this is due to not having the correct jars in my build path, or having one I shouldn't. I appear, however, to have all the jar files the aforementioned question's answerers suggest I need. This a full list of the jars I have added:

client-combined-3.14.0-sources
client-combined-3.14.0
byte-buddy-1.8.15
commons-codec-1.10
commons-exec-1.3
commons-logging-1.2
guava-25.0-jre
httpclient-4.5.5
httpcore-4.4.9
okhttp-3.10.0
okio-1.14.1

Can someone please help me?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
R.Donohoe
  • 59
  • 8
  • Nothing in your question suggests that this a problem other than described in the duplicate. Right now you have just told as you have the right jars, but given the error, that is simply not the case (or you haven't cleaned/rebuilt your project). – Mark Rotteveel Oct 24 '18 at 17:08
  • Your "full list of the jars" is missing selenium-server-standalone-3.X.0.jar, as is mentioned in the linked duplicate question. – SiKing Oct 24 '18 at 19:14
  • Perhaps I don’t understand the solution. It looks to me like the answerer is saying there is a conflict between the selenium-java-3.11.0 JARs and the selenium-server-standalone-3.11.0 JAR, and one of his proposed solutions is to remove all JAR’s except the selenium-java-3.11.0 JARs. As I only had these JARs in the first place, and not the selenium-server-standalone-3.11.0 JAR, it appeared to me that his solution was already implemented in my program. I am a complete beginner, so I have probably misinterpreted this. Could someone please explain what I’ve misunderstood? – R.Donohoe Oct 25 '18 at 07:40
  • adding selenium-server-standalone-3.X.0.jar does not fix the problem – R.Donohoe Oct 25 '18 at 12:13

1 Answers1

1

Please try following code, it is defining driver path manually and also If you are using linux environment, it can be related with permissions to read the drivers path :

System.setProperty("webdriver.gecko.driver","pathToYourDriver/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
sayhan
  • 1,168
  • 1
  • 16
  • 22
  • Why do you want to use _marionette_ bypassing _GeckoDriver_ as in `webdriver.firefox.marionette`? – undetected Selenium Oct 24 '18 at 14:30
  • @DebanjanB I suggest that for a work around. Marionette is the new driver that is shipped/included with Firefox. This driver has it's own protocol which is not directly compatible with the Selenium/WebDriver protocol. The Gecko driver (previously named wires) is an application server implementing the Selenium/WebDriver protocol. It translates the Selenium commands and forwards them to the Marionette driver. – sayhan Oct 24 '18 at 14:32
  • I am not asking the background story but a straight forward question _...Why do you want to use marionette bypassing GeckoDriver as in webdriver.firefox.marionette..._ as it is the very first option within your answer. Thanks for the explanation though. – undetected Selenium Oct 24 '18 at 14:34
  • Ok, I was not completely clear, I suggest that for verification of problem and work around. If marionette is working, it means there is something wrong with geckodriver. – sayhan Oct 24 '18 at 14:38
  • Okay, I wanted you to come back with a clear conclusion that `webdriver.firefox.marionette` is no more a valid _Key_ while using _Selenium v3.x_ and _GeckoDriver_ – undetected Selenium Oct 24 '18 at 14:42
  • Thank you for your response. I am sorry about it. I'll edit this answer. – sayhan Oct 24 '18 at 14:42
  • 1
    It's okay, thats how we learn and contribute. All the best. – undetected Selenium Oct 24 '18 at 14:43
  • I have added the suggested code but still getting the same error – R.Donohoe Oct 24 '18 at 15:18
  • What is your OS? Did you download driver from website or did it via terminal? – sayhan Oct 24 '18 at 20:03
  • macOS high sierra 10.13.6. I downloaded the driver from the website (macOS version). – R.Donohoe Oct 25 '18 at 07:43
  • I asked because, I thought it was about permission to read driver. Can you please try to give permissions to the directory of the driver with highest level or as a root. For example : chown -R username directory @R.Donohoe – sayhan Oct 25 '18 at 08:34
  • Thanks for your help Selcuk. Unfortunately I don't know how to do that, have tried googling to no avail. Could you please step me through? – R.Donohoe Oct 25 '18 at 10:07
  • from terminal in your ide, type : sudo chown -R yourUsername driverDirectory @R.Donohoe – sayhan Oct 25 '18 at 10:15
  • I’m out of my depth here and it may be that I simply don't have the technical know-how to get this sorted without using up too much of your time, so don’t feel obliged to continue this. I have installed TM Terminal, I have a ‘terminal’ tab, there is a flashing black marker indicating I should be able to type inside, but I can’t. How to proceed? – R.Donohoe Oct 25 '18 at 12:33