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 !

  • Could you post the code example? – Prome Nov 22 '19 at 7:44
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(); } }
| improve this answer | |
  • Hi Prome, I deleted your comment by mistake. Here's the code. – user11702680 Nov 22 '19 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 – Nitin Rastogi Nov 22 '19 at 11:04
  • I'll take care of this, thanks for pointing it out. Nithin. – user11702680 Nov 22 '19 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 Nov 22 '19 at 14:09
  • Thanks so much Bharat! – user11702680 Nov 22 '19 at 17:26

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.