0

After upgrading Mac OS X to Catalina, I have been trying to execute a very basic script written in Java for Firefox in Eclipse IDE 2018.
I've installed Gecko driver already through terminal and it's placed in /usr/local/bin.

Although, I've put the path in the script, System.setProperty("webdriver.firefox.marionette","/usr/local/bin/geckodriver");

it keeps showing me error that Webdriver driver = new firefoxDriver cannot be resolved.

CODE:

package newproject; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver;  
import org.openqa.selenium.chrome.ChromeDriver; 
public class PG1 { 
public static void main(String[] args{
System.setProperty("webdriver.firefox.marionette","/usr/local/bin/geckodriver"); 
WebDriver driver = new FirefoxDriver(); 
String baseUrl =  "http://demo.test.com/test/newtours/"; String expectedTitle = "Welcome: Mercury Tours"; 
String actualTitle = ""; // launch Fire fox and direct it to the Base URL driver.get(baseUrl);
 // get the actual value of the title 
actualTitle = driver.getTitle();  (actualTitle.contentEquals(expectedTitle)){ System.out.println("Test Passed!"); } 
else { System.out.println("Test Failed"); } 
//close Fire fox driver.close(); } }

Any help would be appreciated !

1
  • Could you post the code example?
    – Prome
    Commented Nov 22, 2019 at 7:44

1 Answer 1

0
package newproject; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver;  org.openqa.selenium.chrome.ChromeDriver; 
public class PG1 { 
public static void main(String[] args) 
{   System.setProperty("webdriver.firefox.marionette","/usr/local/bin/geckodriver");        
WebDriver driver = new FirefoxDriver();              String baseUrl =  "http://demo.test.com/test/newtours/"; String expectedTitle = "Welcome: Mercury Tours"; 
String actualTitle = ""; // launch Fire fox and direct it to the Base URL driver.get(baseUrl);
 // get the actual value of the title 
actualTitle = driver.getTitle();  (actualTitle.contentEquals(expectedTitle)){ System.out.println("Test Passed!"); } 
else { System.out.println("Test Failed"); } 
//close Fire fox driver.close(); } }
5
  • Hi Prome, I deleted your comment by mistake. Here's the code. Commented Nov 22, 2019 at 10:32
  • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review Commented Nov 22, 2019 at 11:04
  • I'll take care of this, thanks for pointing it out. Nithin. Commented Nov 22, 2019 at 13:04
  • updated the question with your code. Answer would probably gets deleted by Admin soon as it was EDIT of your own question.
    – Bharat Mane
    Commented Nov 22, 2019 at 14:09
  • Thanks so much Bharat! Commented Nov 22, 2019 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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