1
package main_files;

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

public class main_downloader {
    public static void main(String[] args) throws Exception {
        System.setProperty("webdriver.firefox.marionette", "C:\\Users\\ahmed\\Desktop\\JavaPackage\\packages\\webdriver\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.wait(1);
        driver.get("https://www.google.com/");
        driver.quit();
    }
}

idk why, but for some reason this not working !, when I try to run it it just opens a Firefox window and do nothing !, even the search bar "which is supposed to recognize that I'm using a bot and change it's theme" is not doing that, could anyone tell me what's the exact problem please?!, Thx

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
AM Z
  • 423
  • 2
  • 9

1 Answers1

1

The current implementation of Selenium no more uses the key webdriver.firefox.marionette and instead of that you need to use webdriver.gecko.driver. Effectively, you need to replace the line:

System.setProperty("webdriver.firefox.marionette", "C:\\Users\\ahmed\\Desktop\\JavaPackage\\packages\\webdriver\\geckodriver.exe");

with:

System.setProperty("webdriver.gecko.driver", "C:\\Users\\ahmed\\Desktop\\JavaPackage\\packages\\webdriver\\geckodriver.exe");

References

You can find a couple of relevent detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • it didn't work JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)")) 1597445201342 Marionette INFO Listening on port 22663 Aug 15, 2020 1:46:41 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C Exception in thread "main" java.lang.IllegalMonitorStateException at java.lang.Object.wait(Native Method) at main_files.main_downloader.main(main_downloader.java:10)" – AM Z Aug 14 '20 at 22:48
  • but at least it gave me an error this time "and firefox recognizes that i'm using a bot" :) – AM Z Aug 14 '20 at 22:50
  • @AMZ If you have seen the logs as _INFO: Detected dialect: W3C_, this effectively means [Selenium](https://stackoverflow.com/questions/54459701/what-is-selenium-and-what-is-webdriver/54482491#54482491) driven [GeckoDriver](https://stackoverflow.com/questions/45329528/which-firefox-browser-versions-supported-for-given-geckodriver-version/45331403#45331403) initiated [tag:firefox] _Browsing Context_ was successfully initialized. For the following error `IllegalMonitorStateException` can you raise a new question please? – undetected Selenium Aug 14 '20 at 22:54
  • Accepted !, but I have to wait 90 min to ask again :/ – AM Z Aug 14 '20 at 23:02
  • Don't worry, contributors are pretty much regular within Selenium tag. Happy learning. – undetected Selenium Aug 14 '20 at 23:03